Issue Details (XML | Word | Printable)

Key: CORE-2040
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Dmitry Yemanov
Reporter: Alastair Breingan
Votes: 28
Watchers: 17

If you were logged in you would be able to see more operations.
Firebird Core

Allow exception name and possibly exception text to be determined within a "WHEN ANY" error handling block

Created: 13/Aug/08 04:10 AM   Updated: 06/Dec/16 06:42 PM
Component/s: Engine
Affects Version/s: None
Fix Version/s: 4.0 Alpha 1

Issue Links:

QA Status: Covered by another test(s)
Test Details: See functional\exception\handling_name_and_message.fbt

 Description  « Hide
Firebird allows GDSCODE and SQLCODE to be retrieved when handling errors, but not the exception name and text, which will normally be much more common.

This does not allow for a generic error handling routine, which, for example might log the error and re-signal the exception, or for the more user-friendly reporting of all validation errors raised by a trigger (rather than just the first).

Please note that while the text is useful the name is the critical part as the text can always be retrieved from the system tables.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Philip Williams added a comment - 13/Aug/08 11:11 AM
  exception e_some_error 'You cannot insert value ' || something || ' into field ' || someotherthing || ' because of rule ' || morestuff || '.';
when any do
    execute procedure log_error(:ERRNAME, :ERRMESSAGE);

In a case like that, both the name of the exception (e_some_error) and the exact message are important; the message cannot be looked up in system tables, as the one defined for e_some_error is probably simply 'A value could not be inserted into a field because of a rule violation', something generic for documentation purposes.

James Calfee added a comment - 20/Aug/13 07:28 PM
Please provide the RDB$EXCEPTION_NUMBER from RDB$EXCEPTIONS too...