[fpc-devel]Error handling of TReader?

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Sep 4 13:50:35 CEST 2002

Hi all,

The error handling of TReader seems very basic to me:
When TReader encounters an error it calls the user event OnError, which is defined as:

procedure(Reader: TReader; const Message: string; var Handled: Boolean) of object;

The Message is a simple string created from hidden constants. These hidden constants are language dependent and only defined in the hidden implementation part of classes.pp.
Therefore the application has no chance to distinguish errors and can't set the 'handled' value accordingly.
TReader is able to skip nearly any error, but without control you can't use this feature.

Perhaps I have overseen a possibility. Then I hope, someone can explain it.
Otherwise it would be nice, to discuss how to enhance the error handling.

For example PropertyError is called, whenever a property with the searched name does not exists in the component. When converting a VCL form to a LCL form, missing properties should be skipped. It would be nice to have an advanced OnError event. For example 'OnPropertyNotFound' or a more general 'OnBeforeError' event with an ErrorID.

Mattias Gaertner

More information about the fpc-devel mailing list