Validate exit codes more thoroughly. C'mon, Cory.
This commit is contained in:
@ -113,8 +113,8 @@ typedef struct _tf_task_t
|
||||
bool _trusted;
|
||||
bool _one_proc;
|
||||
bool _killed;
|
||||
int32_t _exitCode;
|
||||
char _scriptName[256];
|
||||
int _global_exception_count;
|
||||
|
||||
JSRuntime* _runtime;
|
||||
JSContext* _context;
|
||||
@ -421,11 +421,11 @@ int tf_task_execute(tf_task_t* task, const char* fileName)
|
||||
if (source)
|
||||
{
|
||||
JSValue result = JS_Eval(task->_context, source, strlen(source), fileName, JS_EVAL_TYPE_MODULE | JS_EVAL_FLAG_ASYNC);
|
||||
if (tf_util_report_error(task->_context, result))
|
||||
if (tf_util_report_error(task->_context, result) || task->_global_exception_count)
|
||||
{
|
||||
tf_printf("Reported an error.\n");
|
||||
}
|
||||
if (!JS_IsError(task->_context, result) && !JS_IsException(result))
|
||||
else
|
||||
{
|
||||
executed = true;
|
||||
}
|
||||
@ -1457,6 +1457,8 @@ static void _tf_task_promise_rejection_tracker(JSContext* context, JSValueConst
|
||||
if (!is_handled)
|
||||
{
|
||||
tf_util_report_error(context, reason);
|
||||
tf_task_t* task = tf_task_get(context);
|
||||
task->_global_exception_count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user