24 lines
389 B
JavaScript
24 lines
389 B
JavaScript
'use strict';
|
|
|
|
// Format orchestrator errors
|
|
function formatError(e) {
|
|
if (!e.err) {
|
|
return e.message;
|
|
}
|
|
|
|
// PluginError
|
|
if (typeof e.err.showStack === 'boolean') {
|
|
return e.err.toString();
|
|
}
|
|
|
|
// Normal error
|
|
if (e.err.stack) {
|
|
return e.err.stack;
|
|
}
|
|
|
|
// Unknown (string, number, etc.)
|
|
return new Error(String(e.err)).stack;
|
|
}
|
|
|
|
module.exports = formatError;
|