Subject Re: [firebird-support] Re: How to get last error message in a procedure 2
Author Helen Borrie
At 06:20 AM 3/05/2005 +0000, you wrote:
> > occurred. You would need to create a table (sqlcode, gdscode,
> > text_of_message) in the database to look up the text of the message
>during
> > execution of your error handler.
>
>Thanks Helen!
>
>Do I understand correctly that this way I could handle only firebird
>error messages and not the message my own exceptions raised like this:
>
>
> exception inconsistent_data 'Period start is after period end';
>
>or
>
> exception inconsistent_data 'Period start is NULL';
>
>I wish I could catch these in another procedure which is using this
>procedure and add more info to the message:
>
>when any do
>begin
> exception inconsistent_data 'Problems when processing item no. '
> || :item_no || ', error was: ' || ?????;
>end
>
>... something like SQLERRM in Oracle.
>
>now, is this possible in 1.5? (but what about 2.0?)

It's all possible, but you are limited by that 78 bytes. Oracle's SQLERRM
is something specific to Oracle, which also does exceptions quite differently.

If your nick is anything to guess about, you possibly need non-ascii
characters in your messages, too. For that, and for these really verbose
exception messages, you'll do better to pass a cluster of "meaningful"
bytes back to the application and have it parse them and produce a message
that the user can understand. (By "meaningful", I mean "meaningful to your
error parser").

./heLen