Hi!
 
We have developed an extension that starts ULC's ErrorDialog to show a message and the stacktrace of a Throwable.
For ULC 6.0.x we serialized the Throwable into an Anything on the server (actually only the message and stacktrace) and wrapped that inside a subclass of Throwable that could return the message and print the stacktrace from the contents of that Anything on the client.
 
Now with 6.1 we have a coder on the server that writes the message and stacktrace into two Strings and a coder on the client that creates the client-side wrapper from those strings.
The problem is that registering the server side coder like so
        registry.registerCoder(NullPointerException.class, new ThrowableCoder());
doesn't help since the registry returns only coders for matching classes. So if a coder for NullPointerException is searched none is found, since coders for superclasses are not taken into account.
Registering the coder for any possible Exception class is not possible since we really don't know each kind of Exception that may arise.
We are now forced to create an ExceptionWrapper and register the coder for that wrapper. We'll need to wrap the Exceptions into that wrapper to make sure a coder can be found.
I understand the reason for not taking superclasses into account when searching for coders. It makes the whole system safer. Coders won't be chosen by accident. Nevertheless I think it should be possible to register coders explicitely for a class and any subclasses that don't have coders registered for them. It could be another differently named method like registerCoderForClassAndSupclasses(Class, Coder).
Unfortunately CoderRegistry is final and even if it were not, there doesn't seem to be any way to replace it with a custom implementation.
 
Cheers,
  Robert

Reply via email to