mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-28 04:13:18 +01:00
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]'
>
```
This commit is contained in:
@@ -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();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user