OnError

<< Click to Display Table of Contents >>

Navigation:  Apollo VCL Components > Apollo VCL Component Reference > TApolloConnection > TApolloConnection Events >

OnError

Declaration

OnError(Sender: TObject; Command, Msg: String);

Description

Fires if an error occurs communicating with the server. If no OnError event-handler is defined, the default error message dialog will be displayed. To customize this error display for your user, use this event.

 

The Command parameter holds the name of the procedure/function being executed on the server when the error occurred.

 

The Msg parameter holds the error message text. The error message text may be as brief as just repeating the name of the procedure where the error occurred, or may contain more detailed information, if available.

Delphi Example

// Makes no error messages at all display to user

procedure TForm1.ApolloConnection1Error(Sender: TObject; Command, Msg: String);

begin

 // Silent error 

end;

 

…or…

 

// Displays an error message to the user

procedure TForm1.ApolloConnection1Error(Sender: TObject; Command, Msg: String);

begin

 if MessageDlg( 'Could not connect to remote server: [' + ApolloConnection1.Host + ']. Continue?', mtWarning, [mbYes,mbNo], 0 ) = mrNo then 

         Application.Terminate; 

end;