Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function SigningError(cause) {
this.code = 'SigningError';
assert.optionalObject(cause);
var msg = 'error signing request';
var args = (cause ? [cause, msg] : [msg]);
WError.apply(this, args);
}
util.inherits(SigningError, WError);
function CmdlnError(options) {
assert.object(options, 'options');
assert.string(options.message, 'options.message');
assert.optionalString(options.code, 'options.code');
if (!options.code) options.code = 'Cmdln';
assert.optionalObject(options.cause, 'options.cause');
var self = this;
var args = [];
if (options.cause) args.push(options.cause);
args.push(options.message);
WError.apply(this, args);
var extra = Object.keys(options).filter(
function (k) { return ['cause', 'message'].indexOf(k) === -1; });
extra.forEach(function (k) {
self[k] = options[k];
});
}
util.inherits(CmdlnError, WError);
function HttpError(options) {
assert.object(options, 'options');
options.constructorOpt = options.constructorOpt || HttpError;
WError.apply(this, arguments);
var self = this;
var code = parseInt((options.statusCode || 500), 10);
this.statusCode = code;
this.body = options.body || {
code: codeToErrorName(code),
message: options.message || self.message
};
this.message = options.message || self.message;
}
util.inherits(HttpError, WError);
function HttpError(options) {
assert.object(options, 'options');
options.constructorOpt = options.constructorOpt || HttpError;
WError.apply(this, arguments);
this.name = this.constructor.name;
var self = this;
var code = parseInt((options.statusCode || 500), 10);
this.statusCode = code;
this.body = options.body || {
code: codeToErrorName(code),
message: options.message || self.message
};
this.message = options.message || self.message;
}
util.inherits(HttpError, WError);
function ChecksumError(cause, actual, expected) {
this.code = 'ChecksumError';
if (expected === undefined) {
expected = actual;
actual = cause;
cause = undefined;
}
assert.optionalObject(cause);
assert.string(actual);
assert.string(expected);
var args = [];
if (cause) args.push(cause);
args = args.concat('content-md5 expected to be %s, but was %s',
expected, actual);
WError.apply(this, args);
}
util.inherits(ChecksumError, WError);
function CmdlnError(options) {
assert.object(options, 'options');
assert.string(options.message, 'options.message');
assert.optionalString(options.code, 'options.code');
if (!options.code) options.code = 'Cmdln';
assert.optionalObject(options.cause, 'options.cause');
var self = this;
var args = [];
if (options.cause) args.push(options.cause);
args.push(options.message);
WError.apply(this, args);
var extra = Object.keys(options).filter(
function (k) { return ['cause', 'message'].indexOf(k) === -1; });
extra.forEach(function (k) {
self[k] = options[k];
});
}
util.inherits(CmdlnError, WError);