[Lazarus] Exception dialog

Martin Friebe lazarus at mfriebe.de
Tue Mar 17 15:47:56 CET 2009


Graeme Geldenhuys wrote:
> Please note, I don't use db-aware components, but here follows the
> help from Kylix 3.
>
> On Tue, Mar 17, 2009 at 3:46 PM, Martin Friebe <lazarus at mfriebe.de> wrote:
>   
>> I have to admit, I have limited knowledge of the exact details of the
>> data-aware components, and rather was making a general case about my
>> perception of proper exception use.
>> I just googled  => can you point me to some documentation on it?
>>
>> Following you description, I have no problem if an OnValidate allows the
>> code to use an exception to signal the component some-error state.
>> IMHO the component should have a well defined behaviour on getting this
>> exception.
>>     
>
>
> ==========[ Kylix 3 help ]================
> OnValidate event (TField)
> -------------------------
> Occurs just before the data is written to the record buffer.
>   
.....
> To reject the current value of the field from the OnValidate event
> handler, raise an exception.
>
>   
Then to me the Delphi/Kylix implementation is flawed. Because it forces 
me to do TWO things, even if I want to do only one of them.
There should be:
- an ExceptionClass TDataValitaionException (or whatever) which can be 
used to abort writing the data, but not defer error handling to the mainloop
- any other exception, that aborts the write, and transfers error 
handling to the main loop

There are usages for both scenarios, so they should both be possible.

Best Regards
Martin



More information about the Lazarus mailing list