[JS IR BE] Don't render null messages in Throwable

Set message property to 'undefined' to make Error.prototype.toString
skip it
This commit is contained in:
Svyatoslav Kuzmich
2019-07-03 17:21:37 +03:00
parent 94aebd0101
commit a2625c7bc8
5 changed files with 78 additions and 13 deletions
@@ -87,7 +87,7 @@ internal fun captureStack(instance: Throwable) {
internal fun newThrowable(message: String?, cause: Throwable?): Throwable {
val throwable = js("new Error()")
throwable.message = message ?: cause?.toString()
throwable.message = message ?: cause?.toString() ?: undefined
throwable.cause = cause
throwable.name = "Throwable"
return throwable.unsafeCast<Throwable>()
@@ -95,7 +95,7 @@ internal fun newThrowable(message: String?, cause: Throwable?): Throwable {
internal fun extendThrowable(this_: dynamic, message: String?, cause: Throwable?) {
js("Error").call(this_)
this_.message = message ?: cause?.toString()
this_.message = message ?: cause?.toString() ?: undefined
this_.cause = cause
captureStack(this_)
}