@flitz/errors
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

npm supported flitz version last build PRs Welcome

@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

Package Sidebar

Install

npm i @flitz/errors

Weekly Downloads

1

Version

0.1.3

License

MIT

Unpacked Size

9.43 kB

Total Files

8

Last publish

Collaborators

  • mkloubert