Clean up failed callbacks.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3706 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2021-12-27 21:48:16 +00:00
parent 05b55c849a
commit 2e1b0089ae
3 changed files with 26 additions and 7 deletions

View File

@ -87,8 +87,9 @@ JSValue _util_print(JSContext* context, JSValueConst this_val, int argc, JSValue
return JS_NULL;
}
void tf_util_report_error(JSContext* context, JSValue value)
bool tf_util_report_error(JSContext* context, JSValue value)
{
bool is_error = false;
if (JS_IsError(context, value))
{
const char* string = JS_ToCString(context, value);
@ -109,6 +110,7 @@ void tf_util_report_error(JSContext* context, JSValue value)
{
tf_task_send_error_to_parent(task, value);
}
is_error = true;
}
else if (JS_IsException(value))
{
@ -123,7 +125,9 @@ void tf_util_report_error(JSContext* context, JSValue value)
tf_task_send_error_to_parent(task, exception);
}
JS_FreeValue(context, exception);
is_error = true;
}
return is_error;
}
typedef struct _timeout_t {