@dimosbotsaris/express-error-handler
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Welcome to @dimosbotsaris/express-error-handler 👋

Version Documentation Maintenance Twitter: el_dimious

Simple Express.js middleware middleware to handle errors for APIs and return correct status, error message and trace.

Install

npm install --save @dimosbotsaris/express-error-handler

Usage

import { errorHandler } from '@dimosbotsaris/express-error-handler';

app.get('/bar', (req: Request, res: Response, next: NextFunction) => {
  const error = new Error('Validation Error');
  error.status = 400;
  next(error);
});

app.use(errorHandler({}));

Options

Option Type Default Description
trace Boolean false If true the trace is attached to output.

Run tests

npm run test

Author

👤 Dimos Botsaris

Support Me

ko-fi

Show your support

Give a ⭐️ if this project helped you!

Package Sidebar

Install

npm i @dimosbotsaris/express-error-handler

Weekly Downloads

6

Version

1.0.3

License

ISC

Unpacked Size

16.4 kB

Total Files

5

Last publish

Collaborators

  • dimosbotsaris