Subject | Re: [IBO] SQL Error Trapping |
---|---|
Author | Paul Vinkenoog |
Post date | 2003-06-20T22:39:57Z |
Hi Jack,
This is often not what you want; you can turn this feature on and off
on a per exception class basis, in the Debugger Options.
(Well, you can in BCB; I suppose it's the same in Delphi.)
But after halting and showing you the message, the program is just
paused, not ended. You can resume by clicking Run or Step. And you
_should_ then get to the "except" part of your code, because
EIBO_ISCError is an Exception descendant.
Are you sure the exception handler below is skipped, or do you choose
Program Reset and then restart the app every time?
Paul Vinkenoog
> Am trying to trap errors in the ExecSQL method of tIboSql. The codeThat's the debugger halting on - and informing you of - the exception.
> I wrote is as follows. Comment below shows what actually happens
> when an exception is raised.
>
> SqlError := '';
> with TheQuery do begin
> close;
> with sql do begin
> Clear;
> Add( SQLCommand );
> end;
> try
> ExecSQL;
> (*
> ExecSQL fails with an error message; the exception is not handled
> below. I receive a debugger exception notification stating that my
> project raised exception class EIBO_ISCError with 'ISC ERROR
> CODE:nnn, and an ISC ERROR MESSAGE
> *)
This is often not what you want; you can turn this feature on and off
on a per exception class basis, in the Debugger Options.
(Well, you can in BCB; I suppose it's the same in Delphi.)
But after halting and showing you the message, the program is just
paused, not ended. You can resume by clicking Run or Step. And you
_should_ then get to the "except" part of your code, because
EIBO_ISCError is an Exception descendant.
Are you sure the exception handler below is skipped, or do you choose
Program Reset and then restart the app every time?
> exceptGreetings,
> on e:exception do
> SqlError := e.Message;
> { end }
> { end except }
> end;
> if SqlError <> '' then
> if pWebApp <> nil then
> SendErrorToWebServer
> else
> ShowMessage( sqlError );
> { end if }
> end; { with TheQuery }
Paul Vinkenoog