throwException() utility introduced
This commit is contained in:
@@ -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)))
|
||||||
}
|
}
|
||||||
@@ -221,7 +221,7 @@ object REFLECTION_EVAL : Eval {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e: Throwable) {
|
catch (e: Throwable) {
|
||||||
throw ThrownFromEvalException(ObjectValue(e, Type.getType(e.javaClass)))
|
throwException(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user