forked from cory/tildefriends
Fixed some error reporting.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3733 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
3eabe72299
commit
24cf18651a
@ -249,7 +249,11 @@ async function getProcessBlob(blobId, key, options) {
|
||||
}
|
||||
await process.task.execute({name: blobId, source: appSource});
|
||||
} catch (error) {
|
||||
if (process.app) {
|
||||
process.app.send({action: 'error', error: error});
|
||||
} else {
|
||||
printError({print: print}, error);
|
||||
}
|
||||
rejectReady();
|
||||
}
|
||||
}
|
||||
|
@ -243,10 +243,6 @@ static bool _serialize_storeInternal(tf_task_t* task, tf_taskstub_t* to, buffer_
|
||||
{
|
||||
JS_SetPropertyStr(context, error, "message", message);
|
||||
}
|
||||
else
|
||||
{
|
||||
JS_FreeValue(context, message);
|
||||
}
|
||||
if (JS_IsError(context, exception))
|
||||
{
|
||||
JSValue stack = JS_GetPropertyStr(context, exception, "stack");
|
||||
|
15
src/task.c
15
src/task.c
@ -765,10 +765,17 @@ void tf_task_on_receive_packet(int packetType, const char* begin, size_t length,
|
||||
JSValue utf8 = tf_util_utf8_decode(to->_context, source);
|
||||
const char* source_str = JS_ToCString(to->_context, utf8);
|
||||
JS_FreeValue(to->_context, utf8);
|
||||
_tf_task_executeSource(to, source_str, name);
|
||||
JSValue result = _tf_task_executeSource(to, source_str, name);
|
||||
if (JS_IsException(result))
|
||||
{
|
||||
_tf_task_sendPromiseReject(to, from, promise, JS_GetException(to->_context));
|
||||
}
|
||||
else
|
||||
{
|
||||
_tf_task_sendPromiseResolve(to, from, promise, result);
|
||||
}
|
||||
JS_FreeCString(to->_context, source_str);
|
||||
JS_FreeCString(to->_context, name);
|
||||
_tf_task_sendPromiseResolve(to, from, promise, JS_UNDEFINED);
|
||||
}
|
||||
break;
|
||||
case kKill:
|
||||
@ -930,12 +937,14 @@ static JSValue _tf_task_executeSource(tf_task_t* task, const char* source, const
|
||||
{
|
||||
tf_trace_begin(task->_trace, "_tf_task_executeSource");
|
||||
JSValue result = JS_Eval(task->_context, source, strlen(source), name, 0);
|
||||
tf_util_report_error(task->_context, result);
|
||||
if (!*task->_scriptName)
|
||||
{
|
||||
snprintf(task->_scriptName, sizeof(task->_scriptName), "%s", name);
|
||||
}
|
||||
if (!JS_IsException(result))
|
||||
{
|
||||
tf_task_run_jobs(task);
|
||||
}
|
||||
tf_trace_end(task->_trace);
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user