-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Provide an API to recover stacktrace of the exception when it does not cross coroutine boundary #2607
Labels
Comments
dkhalanskyjb
added a commit
that referenced
this issue
Apr 20, 2021
dkhalanskyjb
added a commit
that referenced
this issue
Apr 20, 2021
dkhalanskyjb
added a commit
that referenced
this issue
Apr 21, 2021
In IJ we often log an error trace and proceed without throwing, this would be a huge help to have the ability to recover full trace. We'd like to obtain “trace when caught” at the point of “trace when thrown” in the following example:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
kotlinx.coroutines
provides a stacktrace recovery machinery in order to provide complete stacktraces that preserve information about all suspended functions in the stracktrace.But the exception recovery only works through coroutine boundaries.
For example, the following code:
will be missing
foo
function from the stacktrace becauseIllegalStateException
does not cross any suspendable coroutine boundaries and stacktrace recovery machinery don't have a chance to kick in.Instead, we could've provided a new top-level suspend function that recovers the stacktrace. Library authors and application developers could've been using that along with stacktrace-sensitive exceptions and/or "expected" failures.
There is a lot of shape for such API, e.g.
throw IllegalStateException().recoverStacktrace()
orbut the biggest question of this issue is whether it is useful for other developers.
Opinions regarding usefulness of such API are welcomed
The text was updated successfully, but these errors were encountered: