Move SysInfoError to BoxError
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
exports = module.exports = {
|
||||
SysInfoError: SysInfoError,
|
||||
|
||||
getPublicIp: getPublicIp,
|
||||
|
||||
hasIPv6: hasIPv6,
|
||||
@@ -15,34 +13,10 @@ var assert = require('assert'),
|
||||
generic = require('./sysinfo/generic.js'),
|
||||
paths = require('./paths.js'),
|
||||
scaleway = require('./sysinfo/scaleway.js'),
|
||||
safe = require('safetydance'),
|
||||
util = require('util');
|
||||
|
||||
function SysInfoError(reason, errorOrMessage) {
|
||||
assert.strictEqual(typeof reason, 'string');
|
||||
assert(errorOrMessage instanceof Error || typeof errorOrMessage === 'string' || typeof errorOrMessage === 'undefined');
|
||||
|
||||
Error.call(this);
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
|
||||
this.name = this.constructor.name;
|
||||
this.reason = reason;
|
||||
if (typeof errorOrMessage === 'undefined') {
|
||||
this.message = reason;
|
||||
} else if (typeof errorOrMessage === 'string') {
|
||||
this.message = errorOrMessage;
|
||||
} else {
|
||||
this.message = 'Internal error';
|
||||
this.nestedError = errorOrMessage;
|
||||
}
|
||||
}
|
||||
util.inherits(SysInfoError, Error);
|
||||
SysInfoError.INTERNAL_ERROR = 'Internal Error';
|
||||
SysInfoError.EXTERNAL_ERROR = 'External Error';
|
||||
safe = require('safetydance');
|
||||
|
||||
let gProvider = null;
|
||||
|
||||
|
||||
function provider() {
|
||||
if (gProvider) return gProvider;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user