mirror of
https://github.com/OptimalBits/bull.git
synced 2026-07-02 08:27:43 +08:00
fix(sandbox): better error reporting broken processor file
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user