fix(sandbox): better error reporting broken processor file

This commit is contained in:
Manuel Astudillo
2022-02-21 16:07:24 +08:00
committed by GitHub
parent 0d5687afaa
commit 10db479731
2 changed files with 5 additions and 4 deletions
+3 -3
View File
@@ -64,7 +64,7 @@ ChildPool.prototype.retain = function(processFile) {
})
.catch(err => {
this.remove(child);
throw new Error(err);
throw err;
});
});
};
@@ -115,8 +115,8 @@ async function initChild(child, processFile) {
const onMessageHandler = msg => {
if (msg.cmd === 'init-complete') {
resolve();
} else {
reject(msg.value);
} else if (msg.cmd === 'error') {
reject(msg.error);
}
child.off('message', onMessageHandler);
};
+2 -1
View File
@@ -50,9 +50,10 @@ process.on('message', msg => {
processor = require(msg.value);
} catch (err) {
status = 'Errored';
err.message = `Error loading process file ${msg.value}. ${err.message}`;
return process.send({
cmd: 'error',
value: `Error loading process file ${msg.value}. ${err.toString()}`
error: err
});
}