boom-clone
Like Boom.wrap
, but returns a cloned boomified error...because Boom.wrap
mutates your error object.
Example
var Boom = var boomClone = var Assert = // Boomify a basic error, without mutating: var basicErr = 'Boom!'// Same API as Boom.wrapvar err = Assert // Not same error objectAssert // Original NOT boomifiedAssert // Cloned has been boomifiedAssert // Status setAssert // Message set // Clone a boom: var boomErr = Boomvar err = Assert // Not same error objectAssert // still a boom though
API
boomClone(error, [statusCode], [message])
Return a cloned boomified error object.
error
A JavaScript Error object[statusCode]
Optional HTTP status code[message]
Optional error message
NOTE: statusCode
and message
are invalid params(!) if passed along with an already boomified error
.
A (╯°□°)╯︵TABLEFLIP side project.