[JS] Fix stack trace capturing from secondary constructors KT-37563

This commit is contained in:
Svyatoslav Kuzmich
2020-06-19 16:42:03 +03:00
parent 6792779281
commit bbfc1a10ad
4 changed files with 6 additions and 5 deletions
@@ -98,7 +98,9 @@ internal fun subSequence(c: CharSequence, startIndex: Int, endIndex: Int): CharS
@JsName("captureStack")
internal fun captureStack(baseClass: JsClass<in Throwable>, instance: Throwable) {
if (js("Error").captureStackTrace) {
js("Error").captureStackTrace(instance, instance::class.js);
// Using uncropped stack traces due to KT-37563.
// Precise stack traces are implemented in JS IR compiler and stdlib
js("Error").captureStackTrace(instance);
} else {
instance.asDynamic().stack = js("new Error()").stack;
}