Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow exception name and possibly exception text to be determined within a "WHEN ANY" error handling block [CORE2040] #947

Closed
firebird-automations opened this issue Aug 13, 2008 · 8 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Alastair Breingan (alb)

Is duplicated by CORE3254
Relate to CORE2382

Votes: 28

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.

Commits: ebd0d3c

====== Test Details ======

See functional\exception\handling_name_and_message.fbt

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

summary: Allow Excepption Name and possibly exception text to be determined within a "WHEN ANY" error handling block. => Allow exception name and possibly exception text to be determined within a "WHEN ANY" error handling block

@firebird-automations
Copy link
Collaborator Author

Commented by: Philip Williams (unordained)

begin
...
exception e_some_error 'You cannot insert value ' || something || ' into field ' || someotherthing || ' because of rule ' || morestuff || '.';
when any do
begin
execute procedure log_error(:ERRNAME, :ERRMESSAGE);
exception;
end
end

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.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Link: This issue is duplicated by CORE3254 [ CORE3254 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: James Calfee (james_jcalfee.info)

Please provide the RDB$EXCEPTION_NUMBER from RDB$EXCEPTIONS too...

@firebird-automations
Copy link
Collaborator Author

Modified by: @mrotteveel

Link: This issue relate to CORE2382 [ CORE2382 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Open [ 1 ] => Open [ 1 ]

QA Status: Covered by another test(s)

Test Details: See functional\exception\handling_name_and_message.fbt

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Fix Version: 4.0 Alpha 1 [ 10731 ]

Component: Engine [ 10000 ]

assignee: Dmitry Yemanov [ dimitr ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants