Avoid `ensure-error` for privacy reasons
Example: ``` > node > const nonError = {foo: 'i-am-private'}; undefined // before > util.inspect(nonError); '{ foo: \'i-am-private\' }' // after > nonError.toString() '[object Object]' > ```pull/1/head
parent
ea07915e6b
commit
43b47fd349
@ -1,7 +1,12 @@
|
||||
const ensureError = require('ensure-error');
|
||||
|
||||
// toLogFormat :: Error -> String
|
||||
exports.toLogFormat = (error) => {
|
||||
const normalizedError = ensureError(error);
|
||||
return normalizedError.stack;
|
||||
if (!error) {
|
||||
return error;
|
||||
}
|
||||
|
||||
if (error && error.stack) {
|
||||
return error.stack;
|
||||
}
|
||||
|
||||
return error.toString();
|
||||
};
|
||||
|
Loading…
Reference in New Issue