# sung-error-handler

> sung-error-handler is a Typescript library to handle error in an eloquent manner

Latest version **3.0.0** (published 2020-09-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install sung-error-handler
pnpm add sung-error-handler
yarn add sung-error-handler
bun add sung-error-handler
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2020-09-25 |
| First published | 2020-09-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 12.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | tjdalsvndn9 |

## Links

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

## Dependencies (4)

- [express](https://npm.io/package/express.md) ^4.17.1
- [body-parser](https://npm.io/package/body-parser.md) ^1.19.0
- [@types/express](https://npm.io/package/@types/express.md) ^4.17.8
- [express-validator](https://npm.io/package/express-validator.md) ^6.6.1

## Recent versions

- 3.0.0 (latest) — 2020-09-25

## README

# Sung Error Handler

sung-error-handler is a Typescript library to handle error in an eloquent manner

## Installation

Use the package manager [npm](https://www.npmjs.com/) to install foobar.

```bash
npm install --save sung-error-handler
```

## Usage

```javascript
import {errorHandler} from "sung-error-handler" 

const app = express()


app.use(errorHandler)

```

```javascript
import {BadRequestError} from "sung-error-handler" 

app.post("/apis/tickets", async (req: Request, res: Response) => {
   try{
       axios.post("")
      //your business logic
    }
  catch(err){
     throw new BadRequestError("custom message")
  }
})

```

```javascript
import {BadRequestError, DatabaseConnectionError, NotFoundError} from "sung-error-handler" 

app.post("/apis/tickets", async (req: Request, res: Response) => {
   try{
       axios.post("")
      //your business logic
    }
  catch(err){
     throw new NotFoundError()
  }
})

```



## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

## License
[MIT](https://choosealicense.com/licenses/mit/)

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