New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

error-manager

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

error-manager

A simple Error type manager for expressjs apps

latest
npmnpm
Version
1.2.1
Version published
Maintainers
1
Created
Source

About

ErrorManager is a very small utility for managing types of Errors in an ExpressJS application.

This is pretty alpha so design may change as I use tweak it in actual real world usage.

Example Usage

It's Coffeescript:

ErrorManager = require "error-manager"

# ==================== 
# Create a new types of errors usable in the application
# ==================== 
ErrorManager.create "MyCustomError"
ErrorManager.create "DatabaseBlewUp"

# ==================== 
# Create a custom express error handling middleware 
# ==================== 
app.use (err, req, res, next) ->
    # errors can be checked  using instanceof
    if ! err instanceof ErrorManager.MyCustomError
        return next(err)

    res.send "Got MyCustomError"

app.use (err, req, res, next) ->
    # errors can also be checked with a is(), which is injected by ErrorManager
    # into the Error object's prototype
    if err.is(ErrorManager.DatabaseBlewUp) == false
        return next(err)

    res.send "Oh snap! The DB blew up."

# ... more error handling middle ware

Installation

It is meant to be installed as part of your package.json via NPM. Just add a "error-manager": "latest" to the dependencies section.

Keywords

error

FAQs

Package last updated on 25 Oct 2012

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