@@ -31,34 +31,33 @@ Rebuilds `error.output` using the other object properties where:
3131
3232##### ` new Boom.Boom(message, [options]) `
3333
34- Creates a new ` Boom ` object using the provided ` message ` and then calling
35- [ ` boomify() ` ] ( #boomifyerr-options ) to decorate the error with the ` Boom ` properties, where:
36- - ` message ` - the error message. If ` message ` is an error, it is the same as calling
37- [ ` boomify() ` ] ( #boomifyerr-options ) directly.
34+ Creates a new ` Boom ` object, where:
35+ - ` message ` - the error message.
3836- ` options ` - and optional object where:
39- - `statusCode` - the HTTP status code. Defaults to `500` if no status code is already set.
37+ - `statusCode` - the HTTP status code. Defaults to `500`.
38+ - ` cause ` - The error that caused the boom error.
4039 - ` data ` - additional error information (assigned to ` error.data ` ).
4140 - ` decorate ` - an option with extra properties to set on the error object.
4241 - ` ctor ` - constructor reference used to crop the exception call stack output.
43- - if `message` is an error object, also supports the other [`boomify()`](#boomifyerr-options)
44- options.
4542
4643##### ` boomify(err, [options]) `
4744
48- Decorates an error with the ` Boom ` properties where:
45+ This works as [ ` new Boom.Boom() ` ] ( #new-boomboommessage-options ) , except when the ` err ` argument is a boom error.
46+ In that case, it will apply the options to the existing error, instead of wrapping it in a new boom error.
47+ Decorates a boom object with the ` Boom ` properties where:
4948- ` err ` - the ` Error ` object to decorate.
5049- ` options ` - optional object with the following optional settings:
5150 - `statusCode` - the HTTP status code. Defaults to `500` if no status code is already set and `err` is not a `Boom` object.
5251 - `message` - error message string. If the error already has a message, the provided `message` is added as a prefix.
53- Defaults to no message.
5452 - `decorate` - an option with extra properties to set on the error object.
5553 - `override` - if `false`, the `err` provided is a `Boom` object, and a `statusCode` or `message` are provided,
5654 the values are ignored. Defaults to `true` (apply the provided `statusCode` and `message` options to the error
5755 regardless of its type, `Error` or `Boom` object).
56+ - it returns the boomified error
5857
5958``` js
60- var error = new Error (' Unexpected input' );
61- Boom .boomify (error, { statusCode: 400 });
59+ const error = new Error (' Unexpected input' );
60+ const boomified = Boom .boomify (error, { statusCode: 400 });
6261```
6362
6463##### ` isBoom(err, [statusCode]) `
0 commit comments