Trying to debug an issue in my server and I’m getting some occurrences of an EROUnregisteredServerException which is passed down to the client, so it’s actually the client that throws an error but says the error occurred on the server.
How can I trap this on the server and actually see what the underlying error is and/or where it’s actually happening?
this error is raised on client-side when client-side can’t detect actual error type.
the logic is:
function TROMessage.CreateException(const aExceptionName, aMessage: string): Exception;
var
lExceptionClass: ExceptionClass;
begin
lExceptionClass := GetExceptionClass(aExceptionName,fDefaultNamespacesList);
if Assigned(lExceptionClass) then begin
// The exception was registered so we can reraise the right type
...
end
else begin
// Un-registered exception. We fire a EROUnregisteredServerException
...
end;
end;
you can override default TROInvoker.CustomHandleMessage method with your own like
function TMyServiceInvoker.CustomHandleMessage(const aFactory: IROClassFactory;
const aMessage: IROMessage;
const aTransport: IROTransport;
out oResponseOptions: TROResponseOptions): boolean;
begin
try
result := inherited CustomHandleMessage(...);
except
on E: EAccessViolation do raise ...
...
on E: Exception do raise;
end;
end;
Don’t quite understand how I override the Invoker classes. These are auto-generated in the …Invk.pas file - surely if I change them the file will just be regenerated when I recompile?
usually adding a exception to RODL in Service Builder is enough.
Pls check the MegaDemo sample - a custom exception is raised on server-side and passed to client.