How To…Handle Exceptions

Question

“How can I handle exceptions on the Server?”

Solution

RB Server automatically handles many common exceptions and sends an error message to the client for display. Unhandled exceptions result in a fatal exception error – the server shuts down and tries to restart itself.
You can add exception handling to yoru custom code by trapping exceptions and re-raising them as EServerError.

 

Sample Delphi code:

uses
  rsExceptions;

begin

  try
     // some code 

  except

    // re-raise as EServerError
    on E: Exception do
      raise EServerError.Create(‘myServer error –  ‘ + E.message);  

  end;

end;