Show correct source position when assert failure
current message for assert failure is always same position
src/iotjs_binding.cpp:329: iotjs::JObject iotjs::JObject::Call(iotjs::JObject&, iotjs::JArgList&): Assertion `is_ok' failed.
Aborted (core dumped)
need to fix this to show real position.
Actually, it is the place where assertion failed.
bool is_ok = jerry_api_call_function(_obj_val.v_object,
this_obj_p,
&res,
val_args,
val_argv);
IOTJS_ASSERT(is_ok);
jerry_api_call_function() returns false when there was something wrong executing the function. I think we can handle this more gracefully by treating the exception. Current implementation returns only JObject that can not hold additional information - wether it is exception or not. I'm planing to extend our binding functionality for handling such exception by introducing new return type something like:
class JResult {
JObject _object;
bool _is_error;
}
ok, good.
#91 landed. Now IoT.js throw exception when something goes wrong but unfortunately, jerry does not provide exact position where the error occurred.
closing. JerryScript also shows error location properly