Subject | RE: [IBO] IBO & Application.HandleException |
---|---|
Author | Calin Pirtea |
Post date | 2006-10-17T08:58:10Z |
Hi Martijn,
If you replace the calls you have to replace them with
if csDesigning in ComponentState then
Application.HandleException( Self )
else
raise;
The catch is that IBO does not expect an exit at that point and that
means some cleanup might not be performed.
On the other hand the vast majority of those
"Application.HandleException" are after procedure/function calls that
are not expected to fail.
A simple example would be:
try
Application.ProcessMessages;
except
on E: Exception do
Application.HandleException( E );
end;
I agree with you that IBO internals should not force an exception to be
handled at low level and not raise the exception at the highest level,
but in order to remove all those "try"s you would have to follow up all
objects that were initialized and are now left in an inconsistent state
and replace the try...except blocks with try...finally in order to
perform cleanup.
If you don't perform the proper cleanup you might not be able to use the
object that raised the exception.
Doesn't look like an easy task to me.
Cheers,
Calin Pirtea
COMMUNICARE DEVELOPMENT TEAM
Communicare Systems Pty Ltd
Australia
+61 (8) 9332 2433
+61 (4) 19 906 150
+61 (8) 9310 1516 (fax)
If you replace the calls you have to replace them with
if csDesigning in ComponentState then
Application.HandleException( Self )
else
raise;
The catch is that IBO does not expect an exit at that point and that
means some cleanup might not be performed.
On the other hand the vast majority of those
"Application.HandleException" are after procedure/function calls that
are not expected to fail.
A simple example would be:
try
Application.ProcessMessages;
except
on E: Exception do
Application.HandleException( E );
end;
I agree with you that IBO internals should not force an exception to be
handled at low level and not raise the exception at the highest level,
but in order to remove all those "try"s you would have to follow up all
objects that were initialized and are now left in an inconsistent state
and replace the try...except blocks with try...finally in order to
perform cleanup.
If you don't perform the proper cleanup you might not be able to use the
object that raised the exception.
Doesn't look like an easy task to me.
Cheers,
Calin Pirtea
COMMUNICARE DEVELOPMENT TEAM
Communicare Systems Pty Ltd
Australia
+61 (8) 9332 2433
+61 (4) 19 906 150
+61 (8) 9310 1516 (fax)
> -----Original Message-----
> From: IBObjects@yahoogroups.com
> [mailto:IBObjects@yahoogroups.com] On Behalf Of Martijn Tonies
> Sent: Tuesday, 17 October 2006 1:41 AM
> To: IBObjects@yahoogroups.com
> Subject: Re: [IBO] IBO & Application.HandleException
>
> Hello Jason,
>
> > > What is the reason IBO code calls
> Application.HandleException( E )?
> > >
> > > In a service application or dll, this fails with showing a dialog
> > > :-(
> > >
> > > Can I remove all these calls, I would like to do all exception
> > > handling myself.
> >
> > I believe you should be able to set an event in the
> Application that
> > would allow you to determine what is done when
> HandleException() is called.
> >
> > If you have an alternative way that keeps the current behavior the
> > same
> and
> > yet it allows you to make a simple change to accomplish
> what you need
> > I
> will
> > include such a change in the next sub-release.
>
> Yes, I can use the event, but please read the other messages
> about this.
>
> When the event is being processed, I do not have access to
> the original calling code.
>
> Martijn Tonies
> Database Workbench - tool for InterBase, Firebird, MySQL,
> NexusDB, Oracle & MS SQL Server Upscene Productions
> http://www.upscene.com <http://www.upscene.com> My thoughts:
> http://blog.upscene.com/martijn/ <http://blog.upscene.com/martijn/>
> Database development questions? Check the forum!
> http://www.databasedevelopmentforum.com
> <http://www.databasedevelopmentforum.com>
>
>
>
>
>