throwException() utility introduced

This commit is contained in:
Andrey Breslav
2013-10-13 00:59:45 +04:00
parent 5ea384a165
commit 0923be42ff
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -101,7 +101,11 @@ val Value.obj: Any?
fun Any?.checkNull(): Any { fun Any?.checkNull(): Any {
if (this == null) { if (this == null) {
throw ThrownFromEvalException(ObjectValue(NullPointerException(), Type.getType(javaClass<NullPointerException>()))) throwException(NullPointerException())
} }
return this return this
}
fun throwException(e: Throwable): Nothing {
throw ThrownFromEvalException(ObjectValue(e, Type.getType(e.javaClass)))
} }
+1 -1
View File
@@ -221,7 +221,7 @@ object REFLECTION_EVAL : Eval {
} }
} }
catch (e: Throwable) { catch (e: Throwable) {
throw ThrownFromEvalException(ObjectValue(e, Type.getType(e.javaClass))) throwException(e)
} }
} }