Subject Re: [IBO] Display Exception message description raised From SP/Trigger
Author Geoff Worboys
> There i have defined no of Exception like following
>
> CREATE EXCEPTION CHEQUE_NOT_ISSUED 'Cheque is not from
> Issued Cheque Books'
<...>
> Can somebody help me in showing the message defined in
> exception definition ?

Using only the facilities provided, your only choice is to extract the
message from the multiple lines of text returned. My own little test
of this shows that EIB_ISCError.ErrorMessage returned the following...

- - - -
ISC ERROR CODE:335544517

ISC ERROR MESSAGE:
exception 1
This is a Test Error

STATEMENT:
TIB_DSQL: "IB_Script."
- - - -

As you can see the actual exception message occurs on the 5th line.
Your processing of EIB_ISCError needs to go something like...

on E: EIB_ISCError do
begin
if (E.ErrCode = isc_except) and
(E.ErrorMessage.Count >= 5) then
desc := E.ErrorMessage.Strings[4]
else
...

Notice that all developer defined database exceptions get returned
using the same errcode isc_except.


PS. I have not tested the above code, but it should be close :-)

HTH

Geoff Worboys
Telesis Computing