After method execute event

In RemObjects SDK is there an event or method that can be overridden to raise an exception before the response is sent back to the client?

I want to raise an exception defined in service library so that it is serialized properly back to the client.

pls specify what platform (Delphi or .NET) you are using

On .NET platform this can be achieved via overriding the InternalDeactivate method of the service:

protected override void InternalDeactivate(Guid clientId)
{
    base.InternalDeactivate(clientId);

    throw new Exception("Test Exception Message");
}

It’s Delphi.

OnDeactivate event of your service:

procedure TFirstSampleService.RORemoteDataModuleDeactivate(
  const aClientID: TGUID; aSession: TROSession);
begin
  raise NewException.Create('Error Message');
end;

There is an issue with this approach as it doesn’t tell me what exception was raised inside a method. I implemented a solution by overriding Service Invoker class and overrode AfterInvoke method.

If Deactivate event supplied an exception just like the AfterInvoke method then it would remove the need to implement custom invoker.

You are right. overriding AfterInvoke allows to catch raised exception and return a new one.