http-errors
Advanced tools
Comparing version 1.3.1 to 1.4.0
@@ -0,1 +1,10 @@ | ||
2016-01-28 / 1.4.0 | ||
================== | ||
* Add `HttpError` export, for `err instanceof createError.HttpError` | ||
* deps: inherits@2.0.1 | ||
* deps: statuses@'>= 1.2.1 < 2' | ||
- Fix message for status 451 | ||
- Remove incorrect nginx status code | ||
2015-02-02 / 1.3.1 | ||
@@ -2,0 +11,0 @@ ================== |
10
index.js
@@ -67,2 +67,8 @@ | ||
var HttpError = exports.HttpError = function HttpError() { | ||
throw new TypeError('cannot construct abstract class'); | ||
}; | ||
inherits(HttpError, Error); | ||
// create generic error objects | ||
@@ -90,3 +96,3 @@ var codes = statuses.codes.filter(function (num) { | ||
} | ||
inherits(ServerError, Error); | ||
inherits(ServerError, HttpError); | ||
ServerError.prototype.status = | ||
@@ -112,3 +118,3 @@ ServerError.prototype.statusCode = code; | ||
} | ||
inherits(ClientError, Error); | ||
inherits(ClientError, HttpError); | ||
ClientError.prototype.status = | ||
@@ -115,0 +121,0 @@ ClientError.prototype.statusCode = code; |
{ | ||
"name": "http-errors", | ||
"description": "Create HTTP error objects", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"author": "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)", | ||
@@ -13,8 +13,8 @@ "contributors": [ | ||
"dependencies": { | ||
"inherits": "~2.0.1", | ||
"statuses": "1" | ||
"inherits": "2.0.1", | ||
"statuses": ">= 1.2.1 < 2" | ||
}, | ||
"devDependencies": { | ||
"istanbul": "0", | ||
"mocha": "1" | ||
"istanbul": "0.4.2", | ||
"mocha": "1.21.5" | ||
}, | ||
@@ -21,0 +21,0 @@ "engines": { |
@@ -26,4 +26,7 @@ # http-errors | ||
All errors inherit from JavaScript `Error` and the exported `createError.HttpError`. | ||
### Error Properties | ||
- `expose` - can be used to signal if `message` should be sent to the client, defaulting to `false` when `status` >= 500 | ||
- `message` | ||
@@ -58,3 +61,3 @@ - `status` and `statusCode` - the status code of the error, defaulting to `500` | ||
[node-version-image]: https://img.shields.io/node/v/http-errors.svg?style=flat | ||
[node-version-url]: http://nodejs.org/download/ | ||
[node-version-url]: https://nodejs.org/en/download/ | ||
[travis-image]: https://img.shields.io/travis/jshttp/http-errors.svg?style=flat | ||
@@ -61,0 +64,0 @@ [travis-url]: https://travis-ci.org/jshttp/http-errors |
8943
110
67
+ Addedinherits@2.0.1(transitive)
- Removedinherits@2.0.4(transitive)
Updatedinherits@2.0.1
Updatedstatuses@>= 1.2.1 < 2