express-error-block

0.2.3 • Public • Published

express-error-block

npm version

A minimalsit simple error handler for Express (4+) which returns an error page.

Support error reporting via next() and handling of 404.

It renders a simple HTML page, which can be customised via options.

Features

  • Customise the page CSS
  • Respond in JSON if appropriate
  • Show a cute illustration
  • Hide error message in production
  • Telegram alerts on bugs

Who uses it?

Nucleus ElioPay Backery Lttrfeed Litch.app

👋 Want to be listed there? Contact me.

How to use

npm install express-error-block

Then require the module

const errorsHandler = require('express-error-block')({
    background: 'red', // Can be any valid CSS background property value
    customCSS: 'body {color: #000}', 
    noImage: false // Hide the default illustrations
})

And add the handlers at the end of your app (just before app.listen())

app.use(errorsHandler.handler)
app.use(errorsHandler.notFound)

Readme

Keywords

none

Package Sidebar

Install

npm i express-error-block

Weekly Downloads

1

Version

0.2.3

License

MIT

Unpacked Size

5.09 kB

Total Files

3

Last publish

Collaborators

  • vincelwt