express-response-errors
Advanced tools
Comparing version 1.0.2 to 1.0.3
'use strict' | ||
const httpErrors = require('./lib/http-error') | ||
const { httpErrorsMiddleware } = require('./lib/middleware') | ||
const statusCodes = require('./lib/code-constants') | ||
const { responseErrorHandler } = require('./lib/middleware') | ||
module.exports = { | ||
...httpErrors, | ||
httpErrorsMiddleware, | ||
statusCodes | ||
httpErrorsMiddleware: responseErrorHandler, // Deprecated | ||
responseErrorHandler | ||
} |
@@ -5,3 +5,3 @@ 'use strict' | ||
exports.httpErrorsMiddleware = function (err, req, res, next) { | ||
exports.responseErrorHandler = function (err, req, res, next) { | ||
if (res.headersSent || !(err instanceof HttpError)) { | ||
@@ -8,0 +8,0 @@ return next(err) |
{ | ||
"name": "express-response-errors", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Collection of custom response errors and middleware for express", | ||
"author": { | ||
"name": "Dwight Rodriques", | ||
"email": "drodriques@gmail.com" | ||
}, | ||
"main": "index.js", | ||
@@ -10,3 +14,3 @@ "engines": { | ||
"scripts": { | ||
"test": "mocha test" | ||
"test": "mocha tests" | ||
}, | ||
@@ -25,20 +29,17 @@ "repository": { | ||
], | ||
"author": { | ||
"name": "Dwight Rodriques", | ||
"email": "drodriques@gmail.com" | ||
}, | ||
"license": "MIT", | ||
"typings": "./types/index.d.ts", | ||
"devDependencies": { | ||
"chai": "^4.1.2", | ||
"eslint": "^5.4.0", | ||
"eslint": "^5.6.0", | ||
"eslint-config-standard": "^12.0.0", | ||
"eslint-plugin-import": "^2.14.0", | ||
"eslint-plugin-node": "^7.0.1", | ||
"eslint-plugin-promise": "^4.0.0", | ||
"eslint-plugin-promise": "^4.0.1", | ||
"eslint-plugin-standard": "^4.0.0", | ||
"express": "^4.16.3", | ||
"mocha": "^5.2.0", | ||
"supertest": "^3.1.0" | ||
"supertest": "^3.3.0" | ||
}, | ||
"dependencies": {} | ||
} |
@@ -16,5 +16,5 @@ # express-response-errors [![NPM Version][npm-image]][npm-url] | ||
```js | ||
const { httpErrorsMiddleware } = require('express-response-errors'); | ||
const { responseErrorHandler } = require('express-response-errors'); | ||
app.use(httpErrorsMiddleware); | ||
app.use(responseErrorHandler); | ||
``` | ||
@@ -51,11 +51,11 @@ | ||
Exceptions passed to Express without a message defaults to HTTP standard status text. | ||
Errors passed to Express without a message defaults to HTTP standard status text. | ||
Exceptions are handled by middleware which sends related error message and status as a HTTP response. | ||
Errors are handled by middleware which sends related error message and status as a HTTP response. | ||
## Base exception | ||
## Base error | ||
- HttpError | ||
## Http specific exceptions | ||
## Named HTTP Errors | ||
@@ -62,0 +62,0 @@ - 400 BadRequestError |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
16486
287
3