New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AssemblyStackTraceException doesn't account for unknown causes #4737
Labels
Comments
Or... well, this is going to be funky, but I guess we could also recreate an entirely new exception that has exactly the same stacktrace but an unset cause. |
I don't see any other way than catcing ISE and signalling to the hooks. Care to submit a PR? |
on it. |
pyricau
added a commit
to pyricau/RxJava
that referenced
this issue
Oct 21, 2016
pyricau
added a commit
to square/retrofit
that referenced
this issue
Oct 22, 2016
In Retrofit 1.x, the exception created by RetrofitError.httpError() has a null cause (aka unknown cause), instead of having a nonexistent cause. This causes issues with RxJava assembly tracking, see [here](ReactiveX/RxJava#4737). The following code crashes: ``` RxJavaHooks.enableAssemblyTracking() // Will crash if the endpoint returns an http error. myService.endpointReturningHttpError().subscribe(...); ```
akarnokd
pushed a commit
that referenced
this issue
Oct 22, 2016
Closing via #4740. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
AssemblyStackTraceException#attachTo method does this:
This assumes that there are two types of exceptions: either it doesn't have a cause and we can set one, or there is a cycle in the chain and it bails.
However, if you look at the JDK Throwable implementation, you'll see this:
So, if you do
new Throwable("", null)
, then the cause is set, and it is null.Throwable.getCause()
will return null, butThrowable.initCause()
will throw. And we just saw thatattachTo
does this:This was introduced when fixing #4212 .
This is going to be tricky to fix, because there is no easy to know "this exception does have a cause and it is set to null".
It's ugly, but we could catch
IllegalStateException
when callinginitCause()
. And even then, I'm not sure what we should do. Reporting toRxJavaHooks.onError();
seems wrong, this isn't necessarily an incorrect exception.FYI, Retrofit 1 has this exact issue (RetrofitError)
The text was updated successfully, but these errors were encountered: