forked from olcxjas-softworks/LarpixClient
Update gitignore (sorry)
This commit is contained in:
parent
a8f8c4d7ad
commit
cca8b02fea
6604 changed files with 1219661 additions and 4 deletions
32
electron/node_modules/ensure-error/index.js
generated
vendored
Normal file
32
electron/node_modules/ensure-error/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
'use strict';
|
||||
const util = require('util');
|
||||
|
||||
class NonError extends Error {
|
||||
constructor(message) {
|
||||
super(util.inspect(message));
|
||||
this.name = 'NonError';
|
||||
Error.captureStackTrace(this, NonError);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = input => {
|
||||
if (!(input instanceof Error)) {
|
||||
return new NonError(input);
|
||||
}
|
||||
|
||||
const error = input;
|
||||
|
||||
if (!error.name) {
|
||||
error.name = (error.constructor && error.constructor.name) || 'Error';
|
||||
}
|
||||
|
||||
if (!error.message) {
|
||||
error.message = '<No error message>';
|
||||
}
|
||||
|
||||
if (!error.stack) {
|
||||
error.stack = (new Error(error.message)).stack.replace(/\n {4}at /, '\n<Original stack missing>$&');
|
||||
}
|
||||
|
||||
return error;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue