boom
Advanced tools
Comparing version 2.10.0 to 2.10.1
@@ -281,3 +281,3 @@ // Load modules | ||
} else { | ||
error = internals.create(statusCode || 500, message, ctor); | ||
error = internals.create(statusCode || 500, message, undefined, ctor); | ||
error.data = data; | ||
@@ -284,0 +284,0 @@ } |
{ | ||
"name": "boom", | ||
"description": "HTTP-friendly error objects", | ||
"version": "2.10.0", | ||
"version": "2.10.1", | ||
"repository": "git://github.com/hapijs/boom", | ||
@@ -19,3 +19,3 @@ "main": "lib/index.js", | ||
"code": "1.x.x", | ||
"lab": "6.x.x" | ||
"lab": "7.x.x" | ||
}, | ||
@@ -22,0 +22,0 @@ "scripts": { |
@@ -30,2 +30,37 @@ ![boom Logo](https://raw.github.com/hapijs/boom/master/images/boom.png) | ||
## Overview | ||
- Helper methods | ||
- [`wrap(error, [statusCode], [message])`](#wraperror-statuscode-message) | ||
- [`create(statusCode, [message], [data])`](#createstatuscode-message-data) | ||
- HTTP 4xx Errors | ||
- 400: [`Boom.badRequest([message], [data])`](#boombadrequestmessage-data) | ||
- 401: [`Boom.unauthorized([message], [scheme], [attributes])`](#boomunauthorizedmessage-scheme-attributes) | ||
- 403: [`Boom.forbidden([message], [data])`](#boomforbiddenmessage-data) | ||
- 404: [`Boom.notFound([message], [data])`](#boomnotfoundmessage-data) | ||
- 405: [`Boom.methodNotAllowed([message], [data])`](#boommethodnotallowedmessage-data) | ||
- 406: [`Boom.notAcceptable([message], [data])`](#boomnotacceptablemessage-data) | ||
- 407: [`Boom.proxyAuthRequired([message], [data])`](#boomproxyauthrequiredmessage-data) | ||
- 408: [`Boom.clientTimeout([message], [data])`](#boomclienttimeoutmessage-data) | ||
- 409: [`Boom.conflict([message], [data])`](#boomconflictmessage-data) | ||
- 410: [`Boom.resourceGone([message], [data])`](#boomresourcegonemessage-data) | ||
- 411: [`Boom.lengthRequired([message], [data])`](#boomlengthrequiredmessage-data) | ||
- 412: [`Boom.preconditionFailed([message], [data])`](#boompreconditionfailedmessage-data) | ||
- 413: [`Boom.entityTooLarge([message], [data])`](#boomentitytoolargemessage-data) | ||
- 414: [`Boom.uriTooLong([message], [data])`](#boomuritoolongmessage-data) | ||
- 415: [`Boom.unsupportedMediaType([message], [data])`](#boomunsupportedmediatypemessage-data) | ||
- 416: [`Boom.rangeNotSatisfiable([message], [data])`](#boomrangenotsatisfiablemessage-data) | ||
- 417: [`Boom.expectationFailed([message], [data])`](#boomexpectationfailedmessage-data) | ||
- 422: [`Boom.badData([message], [data])`](#boombaddatamessage-data) | ||
- 428: [`Boom.preconditionRequired([message], [data])`](#boompreconditionrequiredmessage-data) | ||
- 429: [`Boom.tooManyRequests([message], [data])`](#boomtoomanyrequestsmessage-data) | ||
- HTTP 5xx Errors | ||
- 500: [`Boom.badImplementation([message], [data])`](#boombadimplementationmessage-data) | ||
- 501: [`Boom.notImplemented([message], [data])`](#boomnotimplementedmessage-data) | ||
- 502: [`Boom.badGateway([message], [data])`](#boombadgatewaymessage-data) | ||
- 503: [`Boom.serverTimeout([message], [data])`](#boomservertimeoutmessage-data) | ||
- 504: [`Boom.gatewayTimeout([message], [data])`](#boomgatewaytimeoutmessage-data) | ||
- [FAQ](#faq) | ||
## Helper Methods | ||
@@ -515,2 +550,22 @@ | ||
### `Boom.badImplementation([message], [data])` | ||
Returns a 500 Internal Server Error error where: | ||
- `message` - optional message. | ||
- `data` - optional additional error data. | ||
```js | ||
Boom.badImplementation('terrible implementation'); | ||
``` | ||
Generates the following response payload: | ||
```json | ||
{ | ||
"statusCode": 500, | ||
"error": "Internal Server Error", | ||
"message": "An internal server error occurred" | ||
} | ||
``` | ||
### `Boom.notImplemented([message], [data])` | ||
@@ -595,22 +650,2 @@ | ||
### `Boom.badImplementation([message], [data])` | ||
Returns a 500 Internal Server Error error where: | ||
- `message` - optional message. | ||
- `data` - optional additional error data. | ||
```js | ||
Boom.badImplementation('terrible implementation'); | ||
``` | ||
Generates the following response payload: | ||
```json | ||
{ | ||
"statusCode": 500, | ||
"error": "Internal Server Error", | ||
"message": "An internal server error occurred" | ||
} | ||
``` | ||
## F.A.Q. | ||
@@ -617,0 +652,0 @@ |
@@ -632,1 +632,24 @@ // Load modules | ||
}); | ||
describe('stack trace', function () { | ||
it('should omit lib', function (done) { | ||
['badRequest', 'unauthorized', 'forbidden', 'notFound', 'methodNotAllowed', | ||
'notAcceptable', 'proxyAuthRequired', 'clientTimeout', 'conflict', | ||
'resourceGone', 'lengthRequired', 'preconditionFailed', 'entityTooLarge', | ||
'uriTooLong', 'unsupportedMediaType', 'rangeNotSatisfiable', 'expectationFailed', | ||
'badData', 'preconditionRequired', 'tooManyRequests', | ||
// 500s | ||
'internal', 'notImplemented', 'badGateway', 'serverTimeout', 'gatewayTimeout', | ||
'badImplementation' | ||
].forEach(function (name) { | ||
var err = Boom[name](); | ||
expect(err.stack).to.not.match(/\/lib\/index\.js/); | ||
}); | ||
done(); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73638
641
653