cashapp / zipline

Run Kotlin/JS libraries in Kotlin/JVM and Kotlin/Native programs
Apache License 2.0
2.04k stars 154 forks source link

Propagate JS stacktrace on native #638

Open JakeWharton opened 2 years ago

JakeWharton commented 2 years ago

We can pack it in the message for now so it's not lost. We can also put message and stacktrace properties on QuickJsException for native and do something fancy in the future to assist crash reporting tools.

@kpgalligan

swankjesse commented 1 year ago

We got this for free when we moved to Result types as return values. When we forward an exception we put the JS stacktrace into a ZiplineException.

We’re still not simplifying the stacktrace in native as aggressively as we do on the JVM. https://github.com/cashapp/zipline/blob/trunk/zipline/src/jniMain/kotlin/app/cash/zipline/internal/bridge/throwablesJni.kt#L35

swankjesse commented 1 year ago

I think I’ve taken this as far as it can go without user-defined stacktraces in Kotlin/Native.

I’ve opened a tracking issue to request that feature: https://youtrack.jetbrains.com/issue/KT-59017/New-API-for-Kotlin-Native-Throwable.setStackTraceArrayString

If/when that’s complete, we can un-icebox this.