# error-manager

> A simple Error type manager for expressjs apps

Latest version **1.2.1** (published 2012-10-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install error-manager
pnpm add error-manager
yarn add error-manager
bun add error-manager
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2012-10-25 |
| First published | 2012-10-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Benson Wong |
| Maintainers | mostlygeek |
| Keywords | error, expressjs |

## Links

- npm: https://www.npmjs.com/package/error-manager
- npm.io page: https://npm.io/package/error-manager

## Dependencies (1)

- [coffee-script](https://npm.io/package/coffee-script.md) *

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 1.2.1 (latest) — 2012-10-25
- 1.1.1 — 2012-10-25
- 1.1.0 — 2012-10-25
- 1.0.0 — 2012-10-22

## README

About
====

ErrorManager is a very small utility for managing types of Errors in 
an [ExpressJS](http://expressjs.com/) 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.

---
_Source: https://npm.io/package/error-manager · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
