11.6.109 • Published 12 months ago

@devtea2026/dicta-harum-reprehenderit-provident v11.6.109

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

logomakr_6nl700

All Contributors Build Status codecov npm GitHub license Maintenance

Motivation

This package was created to add a general way to handle exception for express application with the expectation to make it simpler to handle all possible requests.

Installation

add it to your project with npm install @devtea2026/dicta-harum-reprehenderit-provident or yarn add @devtea2026/dicta-harum-reprehenderit-provident

Use

there are 2 different ways to integrate the main functionality of this package, either by adding the handle that gets injected to the router framework

var exceptionHandler = require('@devtea2026/dicta-harum-reprehenderit-provident')
exceptionHandler.handle()
const app = require('express')()

or by wraping manually the routes

var wrap = require('@devtea2026/dicta-harum-reprehenderit-provident').wrap
router.post('/', wrap(async (req, res) => {
    ...
}))

it also integrates an extended class from Error that contains a message and a status that can be used to pass diferent information to the error handle

var httpError = require('@devtea2026/dicta-harum-reprehenderit-provident').exception
router.post('/', async (req, res) => {
    throw new HttpError('Great Message', 400, "{Response: awesome}")
}))

last but not least it also contains a middleware that can be added directly to express that handles the previous named errors.

var middleware = require('@devtea2026/dicta-harum-reprehenderit-provident').middleware
const app = require('express')()
app.use(middleware)

Options

The handle and the wrap function allow configuration parameters to be passed. The default is:

{
  nextOnce: true,
  defaultJsonResponse: false,
}
  • nextOnce: makes sure next can only be called once
  • defaultJsonResponse: runs res.json by default when the internally returned value is an object.

Logo

Arrows graphic by madebyoliver from Flaticon is licensed under CC BY 3.0. Check out the new logo that I created on LogoMaker.com https://logomakr.com/6nL7006nL700

Contributors

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

11.6.109

12 months ago

11.6.108

12 months ago

11.6.107

12 months ago

11.6.106

12 months ago

11.5.106

12 months ago

11.5.105

12 months ago

11.5.104

12 months ago

11.5.103

12 months ago

10.4.80

1 year ago

5.2.51

1 year ago

5.2.50

1 year ago

10.4.73

1 year ago

3.2.35

1 year ago

3.2.34

1 year ago

10.4.75

1 year ago

3.2.37

1 year ago

10.4.74

1 year ago

3.2.36

1 year ago

10.4.77

1 year ago

10.4.76

1 year ago

10.4.79

1 year ago

10.4.78

1 year ago

11.5.92

1 year ago

11.5.93

1 year ago

11.5.94

12 months ago

11.5.95

12 months ago

11.5.96

12 months ago

11.5.97

12 months ago

5.2.49

1 year ago

11.5.98

12 months ago

5.2.48

1 year ago

11.5.99

12 months ago

5.2.47

1 year ago

5.2.46

1 year ago

11.5.102

12 months ago

5.2.45

1 year ago

11.5.101

12 months ago

11.5.100

12 months ago

3.1.34

1 year ago

8.4.56

1 year ago

3.1.33

1 year ago

8.4.57

1 year ago

8.4.58

1 year ago

8.4.59

1 year ago

9.4.69

1 year ago

9.4.68

1 year ago

9.4.67

1 year ago

3.1.32

1 year ago

9.4.62

1 year ago

9.4.61

1 year ago

9.4.66

1 year ago

9.4.65

1 year ago

9.4.64

1 year ago

9.4.63

1 year ago

6.4.54

1 year ago

6.4.56

1 year ago

6.4.55

1 year ago

9.4.73

1 year ago

9.4.72

1 year ago

9.4.71

1 year ago

9.4.70

1 year ago

7.4.56

1 year ago

8.4.60

1 year ago

8.4.61

1 year ago

4.2.42

1 year ago

4.2.43

1 year ago

4.2.44

1 year ago

4.2.45

1 year ago

4.2.40

1 year ago

4.2.41

1 year ago

6.2.51

1 year ago

11.4.80

1 year ago

11.4.81

1 year ago

11.4.82

1 year ago

11.4.83

1 year ago

4.2.39

1 year ago

4.2.37

1 year ago

4.2.38

1 year ago

3.0.23

1 year ago

3.0.24

1 year ago

3.0.21

1 year ago

3.0.22

1 year ago

3.0.27

1 year ago

3.0.28

1 year ago

3.0.25

1 year ago

3.0.26

1 year ago

6.3.54

1 year ago

6.3.52

1 year ago

6.3.53

1 year ago

3.0.20

1 year ago

11.5.90

1 year ago

11.5.91

1 year ago

11.5.83

1 year ago

11.5.84

1 year ago

11.5.85

1 year ago

11.5.86

1 year ago

6.3.51

1 year ago

11.5.87

1 year ago

11.5.88

1 year ago

11.5.89

1 year ago

3.0.19

1 year ago

3.0.32

1 year ago

3.0.30

1 year ago

3.0.31

1 year ago

3.0.29

1 year ago

3.0.18

1 year ago

3.0.17

1 year ago

3.0.16

1 year ago

3.0.15

1 year ago

2.0.15

1 year ago

2.0.14

1 year ago

2.0.13

1 year ago

2.0.12

1 year ago

2.0.11

1 year ago

2.0.10

1 year ago

2.0.9

1 year ago

2.0.8

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago