boom

HTTP-friendly error objects

npm install boom
53 606 downloads in the last day
268 902 downloads in the last week
1 061 444 downloads in the last month

boom Logo

HTTP-friendly error objects

Build Status

List of friendly errors available

Boom.badRequest

example payload for Boom.badRequest('your message');

{
    "statusCode": 400,
    "error": "Bad Request",
    "message": "your message"
}

Boom.unauthorized

example payload for Boom.unauthorized('your message');

{
    "statusCode": 401,
    "error": "Unauthorized",
    "message": "your message"
}

Boom.forbidden

example payload for Boom.forbidden('your message');

{
    "statusCode": 403,
    "error": "Forbidden",
    "message": "your message"
}

Boom.notFound

example payload for Boom.notFound('your message');

{
    "statusCode": 404,
    "error": "Not Found",
    "message": "your message"
}

Boom.methodNotAllowed

example payload for Boom.methodNotAllowed('your message');

{
    "statusCode": 405,
    "error": "Method Not Allowed",
    "message": "your message"
}

Boom.notAcceptable

example payload for Boom.notAcceptable('your message');

{
    "statusCode": 406,
    "error": "Not Acceptable",
    "message": "your message"
}

Boom.proxyAuthRequired

example payload for Boom.proxyAuthRequired('your message');

{
    "statusCode": 407,
    "error": "Proxy Authentication Required",
    "message": "your message"
}

Boom.clientTimeout

example payload for Boom.clientTimeout('your message');

{
    "statusCode": 408,
    "error": "Request Time-out",
    "message": "your message"
}

Boom.conflict

example payload for Boom.conflict('your message');

{
    "statusCode": 409,
    "error": "Conflict",
    "message": "your message"
}

Boom.resourceGone

example payload for Boom.resourceGone('your message');

{
    "statusCode": 410,
    "error": "Gone",
    "message": "your message"
}

Boom.lengthRequired

example payload for Boom.lengthRequired('your message');

{
    "statusCode": 411,
    "error": "Length Required",
    "message": "your message"
}

Boom.preconditionFailed

example payload for Boom.preconditionFailed('your message');

{
    "statusCode": 412,
    "error": "Precondition Failed",
    "message": "your message"
}

Boom.entityTooLarge

example payload for Boom.entityTooLarge('your message');

{
    "statusCode": 413,
    "error": "Request Entity Too Large",
    "message": "your message"
}

Boom.uriTooLong

example payload for Boom.uriTooLong('your message');

{
    "statusCode": 414,
    "error": "Request-URI Too Large",
    "message": "your message"
}

Boom.unsupportedMediaType

example payload for Boom.unsupportedMediaType('your message');

{
    "statusCode": 415,
    "error": "Unsupported Media Type",
    "message": "your message"
}

Boom.rangeNotSatisfiable

example payload for Boom.rangeNotSatisfiable('your message');

{
    "statusCode": 416,
    "error": "Requested Range Not Satisfiable",
    "message": "your message"
}

Boom.expectationFailed

example payload for Boom.expectationFailed('your message');

{
    "statusCode": 417,
    "error": "Expectation Failed",
    "message": "your message"
}

Boom.notImplemented

example payload for Boom.notImplemented('your message');

{
    "statusCode": 501,
    "error": "Not Implemented",
    "message": "An internal server error occurred"
}

Boom.badGateway

example payload for Boom.badGateway('your message');

{
    "statusCode": 502,
    "error": "Bad Gateway",
    "message": "An internal server error occurred"
}

Boom.serverTimeout

example payload for Boom.serverTimeout('your message');

{
    "statusCode": 503,
    "error": "Service Unavailable",
    "message": "An internal server error occurred"
}

Boom.gatewayTimeout

example payload for Boom.gatewayTimeout('your message');

{
    "statusCode": 504,
    "error": "Gateway Time-out",
    "message": "An internal server error occurred"
}

Boom.badImplementation

example payload for Boom.badImplementation('your message');

{
    "statusCode": 500,
    "error": "Internal Server Error",
    "message": "An internal server error occurred"
}
npm loves you