zserio
zserio copied to clipboard
Improve Java ZserioError exception in ZserioIO runtime module
ZserioError does not give any info on nested exceptions when thrown from ZserioIO.
It just prints the message of the top exception. But especially in a remote invocation case this is not always useful.
It was observed that an error in the remoting (mixed up string/byte[]) will get an InvocationTargetException whose message is empty. This did not give any useful information.
It would be nicer to use the following alternatives, at least in the case of a InvocationTargetException which always has a cause:
throw new ZserioError("ZserioIO: " + ex.getCause());
or even better to pass the root cause -- here using guav (could be rewrite by own loop to get the rootcause):
throw new ZserioError("ZserioIO: " + Throwables.getRootCause(ex);
or just pass the nested exception, which will give the stack trace:
throw new ZserioError("ZserioIO: error while reading", ex);
resolved in #350
Thanks a lot to find out this duplicate! We have probably too many issues. ;-)