Skip to content

Commit

Permalink
[add] more information in case of an error in worker
Browse files Browse the repository at this point in the history
  • Loading branch information
bjrmatos committed Jun 15, 2017
1 parent 0f05c2d commit e70b430
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/ElectronWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,18 @@ class ElectronWorker extends EventEmitter {
}

if (payload.error) {
return callback(new Error(payload.error.message || 'An error has occurred when trying to process the task'));
let errorSerialized = JSON.stringify(payload.error);

debugWorker(`task in worker [${this.id}] ended with error: ${errorSerialized}`);

return callback(new Error(
payload.error.message ||
`An error has occurred when trying to process the task: ${errorSerialized}`
));
}

debugWorker(`task in worker [${this.id}] ended successfully`);

callback(null, responseData);
}
}
Expand Down

0 comments on commit e70b430

Please sign in to comment.