Help with RegisterExceptionClass

Hi,

I’m handling OnMaxSessionsReached event and it raises an EROException.

This comes through on the client as an EROUnregisteredServerException.

I’d like it to come through as an EROException so I can handle it properly on the client, and I read that I should be using RegisterExceptionClass.

However, it asks for a namespace parameter and I can’t find any documentation on this.

Where would I call RegisterExceptionClass on the client, and what would I put for the namespace parameter?

Thanks

what server type (RODL-based or Code-First) you are using?
for RODL-based server, it is enough to declare this exception in RODL.
for Code-First server, make sure that your exception has EROServerException ancestor

Hi Evgeny,

I have a RODL based server. How do I set that up in the Service Library Editor? I’ve added a new Exception but I don’t know how to set it up for an exception that already exists (EROException)?

Also – I still don’t know how to use RegisterExceptionClass on the client?

Thanks for your help

it is already registered in _Intf, like

initialization
  RegisterExceptionClass(NewException, DefaultNamespace);

Hi Evgeny.

Thanks. So if I want to register my own exception class, I put:

RegisterExceptionClass(EMyOwnServerException, DefaultNameSpace);

in the initialization section of some unit in the client?

Thanks

better to put it into RODL. in this case, it will be registered on client-side and server-side automatically.

Okay done that - thanks.

I’m still getting the "An exception was raised on the server: " being added to the exception message on the client though - is there anyway to not have that (apart from string manipulation which feels like a bit of a hack).

Thanks in advance.

TROMessage has AddServerExceptionPrefix property.
set it to False

Brilliant - thanks. I’d completely missed that property.

Stu