@c8/errors
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -60,5 +60,5 @@ 'use strict' | ||
*/ | ||
const tryRequestPromiseErrorConversion = (err) => { | ||
const tryRequestPromiseErrorConversion = err => { | ||
// handle request-promise errors | ||
if (err instanceof RequestPromiseErrors.RequestError) { | ||
if (err instanceof RequestPromiseErrors.RequestError || err.name === 'RequestError') { | ||
switch (err.cause.code) { | ||
@@ -81,6 +81,6 @@ case 'ECONNREFUSED': { | ||
} | ||
} else if (err instanceof RequestPromiseErrors.StatusCodeError) { | ||
} else if (err instanceof RequestPromiseErrors.StatusCodeError || err.name === 'StatusCodeError') { | ||
switch (err.statusCode) { | ||
case httpStatus.FORBIDDEN: return Boom.forbidden() | ||
case httpStatus.UNAUTHORIZED: return Boom.unauthorized() | ||
case httpStatus.FORBIDDEN: return Boom.forbidden(err.message) | ||
case httpStatus.UNAUTHORIZED: return Boom.unauthorized(err.message) | ||
} | ||
@@ -135,3 +135,3 @@ } | ||
*/ | ||
bookshelfToC8: (bookshelfErr) => { | ||
bookshelfToC8: bookshelfErr => { | ||
if (!(typeof bookshelfErr === 'object')) return new Error(bookshelfErr) | ||
@@ -138,0 +138,0 @@ if (!bookshelfErr.code) return bookshelfErr |
{ | ||
"name": "@c8/errors", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Common errors and their utils used by C8 management", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
2
14458
8