function createLumberError(name) { function LumberError(message, details) { this.name = name; this.userMessage = message; this.details = details; Error.captureStackTrace(this, this.constructor); } return LumberError; }
debug( 'uncaught exception %s', err !== function () { return this; }.call( err ) ? err : err.message || err );
function connection(x, options) { const error = Object.assign( new Error(('write ' + x + ' ' + (options.path || (options.host + ':' + options.port)))), { code: x, errno: x, address: options.path || options.host }, options.path ? {} : { port: options.port } ) Error.captureStackTrace(error, connection) return error }
function cachedError(xs) { if (originCache.has(xs)) return originCache.get(xs) const x = Error.stackTraceLimit Error.stackTraceLimit = 4 originCache.set(xs, new Error().stack) Error.stackTraceLimit = x return originCache.get(xs) }
constructor(code, result, query, values) { const message = errorMessages[code].message; super(message); this.name = this.constructor.name; this.code = code; this.result = result; this.query = query; this.values = values; this.received = result.rows.length; Error.captureStackTrace(this, this.constructor); }
process.on('uncaughtException', function(err){ if (!err || err.code !== 'ERR_IPC_CHANNEL_CLOSED') { var stack = util.getErrorStack(err); fs.writeFileSync(path.join(process.cwd(), config.name + '.log'), '\r\n' + stack + '\r\n', {flag: 'a'}); /*eslint no-console: "off"*/ console.error(stack); } process.exit(1); });
which(command) { return new Promise(resolve => which(command, (error, resolvedPath) => resolve({ resolvedPath: resolvedPath, error: error ? error.message : null }))); }
const downloadFileFromURI = uri => { return new Promise((res, rej) => { http.get(uri, response => { response.setDefaultEncoding('base64'); let body = `data:${response.headers['content-type']};base64,`; response.on('data', data => body += data); response.on('end', () => res(body)); }).on('error', e => { rej(`Error downloading file from ${uri}: ${e.message}`); }); }); }
/** * Fatal Error. Error code is `"EFATAL"`. * @class FatalError * @constructor * @param {String|Error} data Error object or message */ constructor(data) { const error = (typeof data === 'string') ? null : data; const message = error ? error.message : data; super('EFATAL', message); if (error) this.stack = error.stack; }
function notSupported(x) { const error = Object.assign( new Error(x + ' (B) is not supported'), { code: 'MESSAGE_NOT_SUPPORTED', name: x } ) Error.captureStackTrace(error, notSupported) return error }
constructor(error, pq) { const isQueryFileError = error instanceof QueryFileError; const message = isQueryFileError ? `Failed to initialize 'text' from a QueryFile.` : error; super(message); this.name = this.constructor.name; if (isQueryFileError) { this.error = error; } this.result = pq; Error.captureStackTrace(this, this.constructor); }
constructor(message, ...args) { super(`[Polly] ${message}`, ...args); // Maintains proper stack trace for where our error was thrown (only available on V8) if (Error.captureStackTrace) { Error.captureStackTrace(this, PollyError); } this.name = 'PollyError'; }
constructor(e, { retriable = true } = {}) { super(e) Error.captureStackTrace(this, this.constructor) this.message = e.message || e this.name = 'KafkaJSError' this.retriable = retriable this.helpUrl = e.helpUrl }
/** * Creates a game error. * * @param {string} message The error message. */ constructor(message) { super(message); Error.captureStackTrace(this, GameError); }
constructor(error, ps) { const isQueryFileError = error instanceof QueryFileError; const message = isQueryFileError ? `Failed to initialize 'text' from a QueryFile.` : error; super(message); this.name = this.constructor.name; if (isQueryFileError) { this.error = error; } this.result = ps; Error.captureStackTrace(this, this.constructor); }