Socket
Socket
Sign inDemoInstall

boom

Package Overview
Dependencies
Maintainers
3
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

boom

HTTP-friendly error objects


Version published
Weekly downloads
1.5M
decreased by-0.35%
Maintainers
3
Weekly downloads
 
Created

What is boom?

The boom npm package is a set of utilities for returning HTTP errors. It is part of the hapi ecosystem and provides a way to send error responses that include a friendly error message, the correct HTTP status code, and any additional error information.

What are boom's main functionalities?

Creating HTTP-friendly error objects

Boom allows you to create error objects that are suitable for HTTP responses. For example, you can create a 400 Bad Request error using Boom.badRequest('Invalid request payload input').

{"statusCode": 400, "error": "Bad Request", "message": "Invalid request payload input"}

Decorating error objects

Boom provides a way to decorate error objects with additional information. You can add custom data to an error using Boom.badRequest('Invalid request payload input').data({ custom: 'info' }).

{"statusCode": 400, "error": "Bad Request", "message": "Invalid request payload input", "data": {"custom": "info"}}

Generating errors for various HTTP status codes

Boom has methods for generating errors corresponding to most HTTP status codes, such as Boom.notFound('Resource not found') for a 404 error, or Boom.internal('An internal server error occurred') for a 500 error.

[{"statusCode": 404, "error": "Not Found", "message": "Resource not found"}, {"statusCode": 500, "error": "Internal Server Error", "message": "An internal server error occurred"}]

Other packages similar to boom

Keywords

FAQs

Package last updated on 13 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc