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

nodecaf

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodecaf - npm Package Compare versions

Comparing version 0.7.9 to 0.7.10-beta.2

0

CHANGELOG.md

@@ -0,0 +0,0 @@ # Nodecaf Changelog

31

lib/errors.js

@@ -9,16 +9,21 @@ const createError = require('http-errors');

module.exports = {
NotFound: msg => composeError('NotFound', 404, msg),
Unauthorized: msg => composeError('Unauthorized', 401, msg),
ServerFault: msg => composeError('ServerFault', 500, msg),
InvalidActionForState: msg => composeError('InvalidActionForState', 405, msg),
InvalidCredentials: msg => composeError('InvalidCredentials', 400, msg),
InvalidContent: msg => composeError('InvalidContent', 400, msg),
BadRequest: msg => composeError('BadRequest', 400, msg),
const ERRORS = {
NotFound: 404,
Unauthorized: 401,
ServerFault: 500,
InvalidActionForState: 405,
InvalidCredentials: 400,
InvalidContent: 400,
BadRequest: 400
}
parse(err, msg){
if(typeof this[err] == 'function')
err = this[err](msg || err);
return err;
module.exports = new Proxy({}, {
has(target, key){
return key in ERRORS;
},
get(target, prop){
return msg => composeError(prop, ERRORS[prop], msg);
}
};
});

@@ -8,2 +8,8 @@ const assert = require('assert');

function parseError(err, msg){
if(err in errors)
err = errors[err](msg || err);
return err;
}
function parseContentType(req){

@@ -58,3 +64,3 @@ try{

// this => app
err = errors.parse(err, msg);
err = parseError(err, msg);
input.next(err);

@@ -90,3 +96,3 @@ }

// this => Response object
this.err = errors.parse(err, msg);
this.err = parseError(err, msg);
}

@@ -122,2 +128,3 @@

defaultErrorHandler(err, req, res, next){
let original = err;

@@ -147,4 +154,4 @@ // Run user error handler.

if(err.status == 500)
this.log.error({ req: req, err: err }, 'UNCAUGHT ROUTE ERROR');
this.log.error({ req: req, err: original }, 'UNCAUGHT ROUTE ERROR');
}
}
{
"name": "nodecaf",
"version": "0.7.9",
"version": "0.7.10-beta.2",
"description": "Nodecaf is an Express framework for developing REST APIs in a quick and convenient manner.",

@@ -37,3 +37,3 @@ "main": "lib/main.js",

"compression": "^1.7.4",
"confort": "^0.1.2",
"confort": "^0.1.3-beta.2",
"cookie-parser": "^1.4.4",

@@ -40,0 +40,0 @@ "cors": "^2.8.5",

@@ -0,0 +0,0 @@ # [Nodecaf](https://gitlab.com/GCSBOSS/nodecaf)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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