Subject Re: [IBO] TIB_Query, OnError and RaiseException
Author Dany Marmur
Hi!

I can't say anything on the best way of handling the situation. Here's what
I did and how I figured...

When I set RaiseException to false the processing after the OnError handler
continues. In our case it looks like it should not continue. It seems
processing after tries to fulfill the deletion (or whatever operation). So I
did:

case ERRCODE of:

...
...

// violation of FOREIGN KEY constraint "FK_NAME" on table "REL_NAME"
335544466:
begin
NotificationToolWin.AddEISCErrorMessage(ERRCODE, ErrorMessage,
'FOREIGN KEY Violation');
RaiseException := false;
raise EAbort.Create('');
end;

This is not the exact error you are talking about, but it should exhibit the
same behaviour. Seems to do what I want it to do (this is pascal - you
translate).

After the begin the first row is my own error processing (your message box).
The second line you'll recognize and the third line continues the excption
path in execution without making further noise.

Hope this helps and please comment if I'm doing something bad here :)

/Dany

<support@...> skrev i meddelandet news:atq8de+7pk0@......
> Hello
>
> I'm just learning about IB exceptions and trying to give a more user
> friendly response to the user.
>
> I have a dialog containing a TIB_Grid and an Updatebar. When the
> user tries to delete an entry which is protected by an FK constraint,
> my TIB_Query.OnError shows a messagebox and sets RaiseException=false.
> (This is immediately after clicking delete and before any transaction
> methods are called)
>
> However, my main exception handler (Application->OnException) then
> catches an exception 'Record was not located'. This exception, does
> not pass through TIBQuery.OnError. If I use a IB_SessionProp, this
> does not catch the exception either.
>
> Can anyone tell me what I'm doing wrong, or have hints on the best
> Exceptions handling model.
>
> Thanks
>
> David
>
> Using FB1, IBO4.2H, BCB5, Win2k
>
>
>
>
>
>
___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or
InterBase
> without the need for BDE, ODBC or any other layer.
>
___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info
papers,
> keyword-searchable FAQ, community code contributions and more !
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>