2

I have a Kotlin/JS project that is throwing a null pointer exception, but I can't figure out where it is coming from. The source map in the browser references exceptionUtils.kt?24ab which is a generic wrapper for the javascript error:

@JsName("throwNPE")
internal fun throwNPE(message: String) {
    throw NullPointerException(message)
}

The stack trace for the error shown in the javascript console is, likewise, referencing the javascript bridging code, not my actual Kotlin source:

"NullPointerException

at Object.captureStack (webpack-internal:///./kotlin-dce-dev/kotlin.js:38592:15)

at NullPointerException.Exception [as constructor] (webpack-internal:///./kotlin-dce-dev/kotlin.js:38925:14)

at NullPointerException.RuntimeException [as constructor] (webpack-internal:///./kotlin-dce-dev/kotlin.js:38951:17)

at RuntimeException_init_0 (webpack-internal:///./kotlin-dce-dev/kotlin.js:38962:24)

at new NullPointerException (webpack-internal:///./kotlin-dce-dev/kotlin.js:39071:7)

at Object.throwNPE (webpack-internal:///./kotlin-dce-dev/kotlin.js:42775:13)

at Kotlin.ensureNotNull (webpack-internal:///./kotlin-dce-dev/kotlin.js:748:35)

at main (webpack-internal:///./kotlin-dce-dev/my-app.js:68:27)

at Object.eval (webpack-internal:///./kotlin-dce-dev/my-app.js:431:3)

at eval (webpack-internal:///./kotlin-dce-dev/my-app.js:5:35)"

How can I trace this back to the actual Kotlin source for the exception?

RedBassett
  • 3,469
  • 3
  • 32
  • 56

0 Answers0