Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@c8/errors

Package Overview
Dependencies
Maintainers
6
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@c8/errors - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

30

lib/utils.js

@@ -18,12 +18,12 @@ 'use strict'

// We probably just want to convert these to standard 500
// These errors are automatically converted to 500, can be changed if needs be with something like:
if (
origErr instanceof EvalError ||
origErr instanceof SyntaxError ||
origErr instanceof RangeError ||
origErr instanceof ReferenceError ||
origErr instanceof TypeError ||
origErr instanceof URIError
err instanceof EvalError ||
err instanceof SyntaxError ||
err instanceof RangeError ||
err instanceof ReferenceError ||
err instanceof TypeError ||
err instanceof URIError
) {
return Boom.badImplementation(origErr.message, errParams)
return Boom.XXXXX(origErr.message, errParams)
}

@@ -55,4 +55,5 @@ */

* Translates c8 error to boom error based defined mapping or default mapping
* @param {Error} err Service error
* @param {object} mapping c8 -> Boom mapping
* @param {Error} err Error to convert
* @param {object} customErrors
* @param {object} customMapping
* @return {Error} Boom error

@@ -69,4 +70,3 @@ */

const origErr = _.cloneDeep(err)
const errParams = _.omit(err, 'message')
const errParams = _.omit(_.cloneDeep(err))

@@ -76,8 +76,8 @@ let boomError = (() => {

for (let customErr of mapping[boomErr]) {
if (Errors[customErr] && origErr instanceof Errors[customErr]) {
return Boom[boomErr](origErr.message, errParams)
if (Errors[customErr] && err instanceof Errors[customErr]) {
return Boom[boomErr](err.message, errParams)
}
}
}
})() || Boom.wrap(origErr) // defaults to HTTP 500 status
})() || Boom.wrap(err) // defaults to HTTP 500 status

@@ -84,0 +84,0 @@ // Make err.data publicly available so we can send extra intel like custom error codes.

{
"name": "@c8/errors",
"version": "0.1.3",
"version": "0.1.4",
"description": "Common errors and their utils used by C8 management",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc