New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fi-errors

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fi-errors - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

2

lib/defaults.js

@@ -39,3 +39,3 @@ 'use strict';

name: 'InternalServerError',
message: 'Something went bad in the server.',
message: 'There was a problem on the server with this request.',
code: 500

@@ -42,0 +42,0 @@ }],

@@ -93,2 +93,3 @@ 'use strict';

*
* @private
* @param {String} message The error's message.

@@ -215,29 +216,36 @@ */

/**
* Resolve the error catched by the component handler.
* Resolve the error catched by the handler.
*
* @private
* @param {Object} error The catched error.
* @param {Error} err The catched error.
*
* @returns {Error} A fi-errors registered error.
* @returns {Error} A proper error.
*/
function _resolveError(error) {
error = error || {};
function _resolveError(err) {
// It's an invalid error.
if (!err || !(err instanceof Error)) {
return new errors.InternalServerError();
}
// Its a registered component error.
if (errors[error.name]) {
return error;
// It's a registered component error.
if (errors[err.name]) {
return err;
}
// It's registered in the handlers with an error name.
if (handlers[error.name]) {
return new handlers[error.name]();
if (handlers[err.name]) {
return new handlers[err.name]();
}
// It's registered in the handlers with an error code.
if (handlers[error.code]) {
return new handlers[error.code]();
if (handlers[err.code]) {
return new handlers[err.code]();
}
// It's not a registered error nor a known error handler.
return new errors.InternalServerError();
if (is.not.within(err.code, 99, 600)) {
err.code = 500;
}
return err;
}

@@ -244,0 +252,0 @@

{
"name": "fi-errors",
"title": "Fi Errors",
"version": "2.1.0",
"version": "2.1.1",
"description": "Error manangement middleware for ExpressJS",

@@ -6,0 +6,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