Socket
Socket
Sign inDemoInstall

@c8/errors

Package Overview
Dependencies
Maintainers
5
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.2.2 to 0.2.3

2

lib/utils.js

@@ -119,3 +119,3 @@ 'use strict'

}
})() || Boom.wrap(err) // defaults to HTTP 500 status
})() || (err.name = 'AuthenticationError') ? Boom.unauthorized(err) : Boom.wrap(err) // defaults to HTTP 500 status

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

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

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

@@ -19,2 +19,13 @@ /* eslint-env mocha */

// Passport JWT Error
function AuthenticationError(message, status) {
Error.call(this);
// Error.captureStackTrace(this, arguments.callee);
this.name = 'AuthenticationError';
this.message = message;
this.status = status || 401;
}
AuthenticationError.prototype.__proto__ = Error.prototype;
// ----------------------------
const testParams = {

@@ -33,3 +44,3 @@ param1: 'test1',

forbidden: ['ForbiddenErr'],
unauthorized: ['Unauthorized1', 'Unauthorized2']
unauthorized: ['Unauthorized1', 'Unauthorized2', 'AuthenticationError']
}

@@ -169,2 +180,14 @@

})
describe('Passport JWT Auth error handling', () => {
let err
before(() => {
err = Errors.utils.toBoom(new AuthenticationError(401), MyCustomErrors, customMapping)
})
it('should return 401', () => {
err.should.have.a.deep.property('output.statusCode', 401)
})
})
})
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