[ros-kernel] Re: Enhanced error messages

Joseph Galbraith galb-list at vandyke.com
Mon Jan 5 16:51:44 CET 2004


Martin Fuchs wrote:

>>One other thing. Could we make this functionality you want to add a
>>macro rather than a new exported function?
>>
>>Thanks
>>Steven
> 
> 
> My idea was to extend FormatMessage() internally.
> So no user program has to call (directly) this new exported functions.
> It would would get the enhanced error messages automatically.
> This change is no cause of compatibility problems, since no one
> can expect the messages in a specific format anyways - it's already
> internationalized and different from language to language.

On the other hand, apps I write do use FormatMessage and
then combine that information with the filename, so that under
windows I get:

   Could not open C:\Documents and Settings\galb.mydomain\Application 
Data\Xyzzy\foo.txt: File not found

If I understand your proposal correctly, my app running under
ros would give me:

   Could not open C:\Documents and Settings\galb.mydomain\Application 
Data\Xyzzy\foo.txt: "C:\Documents and Settings\galb.mydomain\Application 
Data\Xyzzy\foo.txt" not found

which seems a little bit obnoxious (I deliberately choose a long file
name to make it more obnoxious :-)

> However we could export the functions for future applications,
> which may be ROS-aware, perhaps naming them
> ROS_SetLastErrorWithInfo() and ROS_GetLastErrorInfo().

Given that applications may depend on the fact that system
error messages don't include object names etc., I don't
believe we can change the messages.

Really, if we wanted to support this, maybe an extra
flag to SetErrorMode() could swap out the message tables
used in the system dlls, with ones containing inserts
("%1" not found, for example) and then an application
would be required to either pass in the results of
ROS_GetLastErrorInfo() as the Arguments parameter
of FormatMessage(), or pass the flag to ignore inserts.

ROS native applications could SetErrorMode(SMART_MESSAGE_TABLES)

But windows native applications would continue to get the original
error messages (that don't have the inserts.)

- Joseph


More information about the Ros-kernel mailing list