UNPKG

gbox-errors

Version:

Error handlers

23 lines 647 B
module.exports = { validate: function (error) { if (this.error5xx(error)) { if (this.gboxError(error)){ return "gbox"; }else { return "5xx"; } } else { return "4xx"; } }, gboxError: function (data) { if (data.hasOwnProperty('raw') && data.raw.hasOwnProperty('error') && data.raw.error.hasOwnProperty('details') && data.raw.error.details.hasOwnProperty('generateBy')) { return true; } }, error5xx: function (data) { if (data instanceof Error) { return true; } } };