Add soft assert handler to jerry-ext (#2516)
Allow developers to choose whether they want a hard or a soft implementation behind `assert`, i.e., whether they want to kill the whole engine in case of an assertion failure in the executed script or just throw a JS error. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
# Common external function handlers
|
||||
|
||||
## jerryx_handler_assert
|
||||
## jerryx_handler_assert_fatal
|
||||
|
||||
**Summary**
|
||||
|
||||
Assert for scripts. The routine calls `jerry_port_fatal` on assertion failure.
|
||||
Hard assert for scripts. The routine calls `jerry_port_fatal` on assertion failure.
|
||||
|
||||
**Prototype**
|
||||
|
||||
```c
|
||||
jerry_value_t
|
||||
jerryx_handler_assert (const jerry_value_t func_obj_val, const jerry_value_t this_p,
|
||||
const jerry_value_t args_p[], const jerry_length_t args_cnt);
|
||||
jerryx_handler_assert_fatal (const jerry_value_t func_obj_val, const jerry_value_t this_p,
|
||||
const jerry_value_t args_p[], const jerry_length_t args_cnt);
|
||||
```
|
||||
|
||||
- `func_obj_val` - the function object that was called (unused).
|
||||
@@ -27,6 +27,43 @@ jerryx_handler_assert (const jerry_value_t func_obj_val, const jerry_value_t thi
|
||||
- [jerryx_handler_register_global](#jerryx_handler_register_global)
|
||||
|
||||
|
||||
## jerryx_handler_assert_throw
|
||||
|
||||
**Summary**
|
||||
|
||||
Soft assert for scripts. The routine throws an error on assertion failure.
|
||||
|
||||
**Prototype**
|
||||
|
||||
```c
|
||||
jerry_value_t
|
||||
jerryx_handler_assert_throw (const jerry_value_t func_obj_val, const jerry_value_t this_p,
|
||||
const jerry_value_t args_p[], const jerry_length_t args_cnt);
|
||||
```
|
||||
|
||||
- `func_obj_val` - the function object that was called (unused).
|
||||
- `this_p` - the `this` value of the call (unused).
|
||||
- `args_p` - the array of function arguments.
|
||||
- `args_cnt` - the number of function arguments.
|
||||
- return value - `jerry_value_t` representing boolean true, if only one argument
|
||||
was passed and that argument was a boolean true, an error otherwise.
|
||||
|
||||
**See also**
|
||||
|
||||
- [jerryx_handler_register_global](#jerryx_handler_register_global)
|
||||
|
||||
|
||||
## jerryx_handler_assert_fatal
|
||||
|
||||
**Summary**
|
||||
|
||||
An alias to `jerryx_handler_assert_fatal`.
|
||||
|
||||
**See also**
|
||||
|
||||
- [jerryx_handler_assert_fatal](#jerryx_handler_assert_fatal)
|
||||
|
||||
|
||||
## jerryx_handler_gc
|
||||
|
||||
**Summary**
|
||||
|
||||
Reference in New Issue
Block a user