3.0.0 • Published 4 years ago

sung-error-handler v3.0.0

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

Sung Error Handler

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

Installation

Use the package manager npm to install foobar.

npm install --save sung-error-handler

Usage

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

const app = express()


app.use(errorHandler)
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")
  }
})
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

3.0.0

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.0.0

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago