Add informative NoSuchElementException message

This commit is contained in:
Iaroslav Postovalov 2020-12-20 19:02:36 +07:00
parent 3cd00b9df6
commit 95701bec1b
No known key found for this signature in database
GPG Key ID: 46E15E4A31B3BCD7

View File

@ -70,9 +70,8 @@ internal class JSBuilder<T>(val bodyCallback: JSBuilder<T>.() -> BaseExpression)
val k = key
val o = `object`
if (!(js("k in o") as Boolean)) {
throw NoSuchElementException()
}
if (!(js("k in o") as Boolean))
throw NoSuchElementException("Key $key is missing in the map.")
js("o[k]")
}