Socket
Book a DemoInstallSign in
Socket

oh-my-errors

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oh-my-errors

Simple node module to handle multiple server-side errors with solution strategies

latest
Source
npmnpm
Version
1.0.5
Version published
Weekly downloads
1
-75%
Maintainers
1
Weekly downloads
 
Created
Source

Oh my errors!

Simple node module to handle multiple server-side errors with solution strategies.

How to use it

const errorHandler = require('oh-my-errors')

const error404 = errorHandler.createNotFoundError404({
  origin: 'PLACE in your application where this error was originated',
  message: 'Resource not found'
})

API methods

MethodParameters
createNotImplementedError501 {String=} data.origin, {String=} data.message
createBadRequest400{String=} data.origin, {String=} data.message
createUnauthorizedError401{String=} data.origin, {String=} data.message
createForbiddenError403{String=} data.origin, {String=} data.message
createNotFoundError404{String=} data.origin, {String=} data.message
createInternalError500{String=} data.origin, {String=} data.message

Possible errors

We support the most commun errors from HTTP Status codes

  • 400 -> BadRequest (any params or whatever is bad)
  • 401 -> UnauthorizedError (like 403, but in cases when you need to login)
  • 404 -> NotFound (Resource not found. For example: user in the database, items, pages, etc...)
  • 501 -> NotImplementedError

Contribute!

Keywords

errors

FAQs

Package last updated on 05 Jul 2017

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