Skip to main content

TdxServerModeCustomDataSource.OnFatalError Event

Occurs when the data source is unable to continue fetching data from the connected database.

Declaration

property OnFatalError: TdxServerModeDataSourceFatalErrorEvent read; write;

Remarks

This event occurs when either of the following takes place:

  • An exception occurs on obtaining data from the database;

  • The data source failed to recover the consistency of its internal cache after three consecutive attempts, which are made even if the OnInconsistentCache event is not handled.

Sender references the data source. At the moment the OnFatalError event is fired, the data source is closed.

The AMessage parameter contains the error message.

The following code shows how to handle the OnFatalError event to prompt end-users to reload data if an error occurs.

procedure <Form>.<ServerModeDataSource>FatalError(Sender: TdxServerModeCustomDataSource; const AMessage: string);
var
  S: string;
begin
  S := 'The following error occurred when obtaining data: "%s". Do you want to reload the data?';
  if MessageDlg(Format(S, [AMessage]), mtError, [mbYes, mbNo], 0) = mrYes then
    Sender.Open;
end;
See Also