@flitz/errors
Creates an error handler for flitz with pretty HTML output.
Install
Run
npm install --save @flitz/errors
from the folder, where your package.json
is stored.
Usage
const flitz = require('flitz');
const errors = require('@flitz/errors');
const run = async () => {
const app = flitz();
app.get('/', async (req, res) => {
throw new ReferenceError('Oops! Something went wrong!');
});
app.setErrorHandler(errors());
await app.listen(3000);
};
run();
Or the TypeScript way:
import flitz from 'flitz';
import { errors } from '@flitz/errors';
const run = async () => {
const app = flitz();
app.get('/', async (req, res) => {
throw new ReferenceError('Oops! Something went wrong!');
});
app.setErrorHandler(errors());
await app.listen(3000);
};
run();
A possible result could be (the Show all frames
was checked when took screenshot btw.):
TypeScript
TypeScript is optionally supported. The module contains its own definition files.
Credits
The module makes use of:
License
MIT © Marcel Kloubert