JS: fix support of throwable constructors without message and/or cause parameters

This commit is contained in:
Alexey Andreev
2016-12-29 15:52:47 +03:00
parent 6f4d8decc7
commit 115f6ced87
11 changed files with 99 additions and 8 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ internal fun captureStack(baseClass: JsClass<in Throwable>, instance: Throwable)
@JsName("newThrowable")
internal fun newThrowable(message: String?, cause: Throwable?): Throwable {
val throwable = js("new Error()")
throwable.message = message
throwable.message = if (jsTypeOf(message) == "undefined" && cause != null) cause.toString() else message
throwable.cause = cause
return throwable
}