Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'cannot specify both global and owner_uuid'));
}
if (!hasOwnProperty(data, 'global') &&
!hasOwnProperty(data, 'owner_uuid')) {
errs.push(new validators.InvalidParamError('owner_uuid',
'owner_uuid required'));
}
}
if (errs.length !== 0) {
if (errs.length === 1) {
throw errs[0];
}
throw new verror.MultiError(errs);
}
// -- translate into the internal rule format --
var d;
var dir;
this.action = parsed.action;
this.priority = parsed.priority || 0;
this.protocol = parsed.protocol.name;
switch (this.protocol) {
case 'icmp':
case 'icmp6':
this.types = icmpTypeSort(parsed.protocol.targets);
this.protoTargets = this.types;
function _validateInput(schema, config, cb) {
var ajv = new Ajv({allErrors: true, verbose: true, format: 'full'});
var validate = ajv.compile(schema);
var valid = validate(config);
if (!valid) {
// ajv does not return a real error object, hence the dance here to
// produce real errors.
var errors = _.map(validate.errors, function (fakeErr) {
return new verror.VError({
name: 'EnrouteConfigValidationError',
info: fakeErr
}, 'config validation error');
});
var err = new verror.MultiError(errors, 'Invalid input');
return cb(err);
} else {
return cb(null, _.cloneDeep(config));
}
}
import VError = require("verror");
import { VError as VError2, MultiError, SError, WError } from "verror";
const error = new Error("foo");
const verror1 = new VError(error, "bar");
const verror2 = new VError2(error, "bar");
const serror = new SError(error, "bar");
const multiError = new MultiError([verror1, verror2]);
const werror = new WError(verror1, "foobar");
const verror3 = new VError({
name: "fooError",
cause: error,
info: {
"info0": "baz"
}
}, "bar");
const verror4 = new VError({ cause: null }, "bar");
const cause1: Error | undefined = verror1.cause();
const cause2: Error | undefined = werror.cause();
const info: { [k: string]: any } = VError.info(verror3);
function promptForWarnings(_, cb) {
if (_.clusterWarnings.length === 0) {
cb();
return;
}
var msg = [
'The cluster is currently experiencing a number of warnings ' +
'and/or errors. Review the following and determine if they ' +
'can be ignored.'
].join('');
var promptMsg = 'Ignore warning(s)?';
console.error(msg);
printVErrorIter(new VError.MultiError(_.clusterWarnings), 2);
prompt.start({
message: promptMsg
});
prompt.get(['no'], function (err, result) {
if (err) {
cb(err);
return;
}
if (result.no !== 'yes' && result.no !== 'y') {
cb(new VError('aborting promotion due to warnings'));
return;
}
/*
* If we don't set this variable then the prompt library will
entry['status'] = err ? 'fail' : 'ok';
if (err)
rv['nerrors']++;
else
rv['successes'].push(result);
if (++rv['ndone'] < funcs.length)
return;
var errors = rv['operations'].filter(function (ent) {
return (ent['status'] == 'fail');
}).map(function (ent) { return (ent['err']); });
if (errors.length > 0)
callback(new mod_verror.MultiError(errors), rv);
else
callback(null, rv);
});
};
!this.ajv.validate(
{
oneOf: [
{$ref: 'bakeryjs/flow'},
{$ref: 'bakeryjs/flowbuilder'},
],
},
flowDesc
)
) {
const errs = this.ajv.errors;
if (errs) {
throw new VError(
{
name: 'JobValidationError',
cause: new MultiError(
errs
.filter((e) => e.dataPath !== '')
.map((e) => new VError(e.message))
),
info: {
schema: [
this.ajv.getSchema('bakeryjs/flowbuilder'),
this.ajv.getSchema('bakeryjs/flow'),
],
},
},
'Job definition should match exactly one of the two schemes.',
true
);
}
}
entry['status'] = err ? 'fail' : 'ok';
if (err)
rv['nerrors']++;
else
rv['successes'].push(result);
if (++rv['ndone'] < funcs.length)
return;
var errors = rv['operations'].filter(function (ent) {
return (ent['status'] == 'fail');
}).map(function (ent) { return (ent['err']); });
if (errors.length > 0)
callback(new mod_verror.MultiError(errors), rv);
else
callback(null, rv);
});
};
function createMultiError(errs) {
if (errs.length == 1) {
return errs[0];
}
var details = [];
var err = new verror.MultiError(errs);
errs.forEach(function (e) {
if (hasKey(e, 'details')) {
details.push(e.details);
}
});
if (details.length !== 0) {
err.details = details;
}
return err;
}
entry['status'] = err ? 'fail' : 'ok';
if (err)
rv['nerrors']++;
else
rv['successes'].push(result);
if (++rv['ndone'] < funcs.length)
return;
var errors = rv['operations'].filter(function (ent) {
return (ent['status'] == 'fail');
}).map(function (ent) { return (ent['err']); });
if (errors.length > 0)
callback(new mod_verror.MultiError(errors), rv);
else
callback(null, rv);
});
};