grpc-kotlin
grpc-kotlin copied to clipboard
Translate unknown exceptions to UNKNOWN Status
When using fromThrowable for unknown exceptions, we are recursively looking for a StatusException or StatusRuntimeException and returning the status of an inner exception. This isn't really the correct behavior because an inner exception that is not caught by the application and not explicitly converted to a StatusException doesn't necessarily translate to the Status that should be returned by the application. More importantly, returning the inner status exception with it's parent as a cause inverts the stacktrace (it looks as if the parent exception is the cause of the status exception but it's the opposite), which leads to confusing stacktraces.
In fact, there is still a problem with the stacktrace if ServiceA is calling ServiceB which throws a status exception that is not caught by ServiceA. The stacktrace would only show the code path in ServiceB and the stacktrace in ServiceA would be lost.. there is more that needs to be done to fix this issue..
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: nehme-bilal-ah / name: Nehme (2955cb79e818eea496b39f74d051c092a8337a0f)
@lowasser are you able to take a look at this PR?