Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
error.toPOJO = function() {
var errorKey = 'Errors';
if (sails && sails.config && sails.config.errors &&
typeof sails.config.errors.errorKey === 'string') {
errorKey = sails.config.errors.errorKey;
}
if (!toJSON) {
toJSON = WLError.prototype.toJSON;
}
var asJSON = toJSON.call(this);
asJSON[errorKey] = this.Errors;
return asJSON;
};