[Lazarus] Exception dialog
Martin Friebe
lazarus at mfriebe.de
Tue Mar 17 13:09:33 CET 2009
Luca Olivetti wrote:
> En/na Hans-Peter Diettrich ha escrit:
>
>
>> Insert your exception handler in an more appropriate place, depending on
>> the concrete application. The user can expect a diagnosis of what went
>> wrong, and a chance for correcting his preceding input.
>>
>
> For data aware components (and probably for others too),
> Application.OnException is the only place, otherwise you cannot trap
> exception that are no caused by your program flow but by intrinsic
> processing by the component (e.g. during post the database could reject
> the data due to failed constraints, you could trap BeforePost or
> AfterPost but not DuringPost).
>
If a component throws an exception outside any call from your code
(which you can place in a "try except end"), a place like OnDataReceived
which is triggered automatically, then this component has a bug (IMHO).
The component *should* have something like an OnError event on which it
can call your code. Or it should have a flag/state, on which it said
that an error occurred.
An Exception may be, if an OnError event is provided, but not assigned.
Best Regards
Martin
More information about the Lazarus
mailing list