# @flitz/errors

> Pretty error handling for flitz.

Latest version **0.1.3** (published 2020-07-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @flitz/errors
pnpm add @flitz/errors
yarn add @flitz/errors
bun add @flitz/errors
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2020-07-24 |
| First published | 2020-07-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10.0.0 |
| Dependencies | 1 |
| Unpacked size | 9.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Marcel Joachim Kloubert |
| Maintainers | mkloubert, mkloubertego |
| Keywords | flitz, error, errors, error-reporting, handling, html, pretty, beautify, youch, whoops, typescript |

## Links

- npm: https://www.npmjs.com/package/@flitz/errors
- Repository: https://github.com/flitz-js/errors
- Homepage: https://github.com/flitz-js/errors#readme
- Issues: https://github.com/flitz-js/errors/issues
- npm.io page: https://npm.io/package/@flitz/errors

## Dependencies (1)

- [youch](https://npm.io/package/youch.md) ^2.0.10

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 0.1.3 (latest) — 2020-07-24
- 0.1.2 — 2020-07-22
- 0.1.1 — 2020-07-22
- 0.1.0 — 2020-07-22

## README

[![npm](https://img.shields.io/npm/v/@flitz/errors.svg)](https://www.npmjs.com/package/@flitz/errors) [![supported flitz version](https://img.shields.io/static/v1?label=flitz&message=0.11.5%2B&color=blue)](https://github.com/flitz-js/flitz) [![last build](https://img.shields.io/github/workflow/status/flitz-js/errors/Publish)](https://github.com/flitz-js/errors/actions?query=workflow%3APublish) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/flitz-js/errors/pulls)

# @flitz/errors

> Creates an error handler for [flitz](https://github.com/flitz-js/flitz) with [pretty HTML output](https://github.com/poppinss/youch).

## Install

Run

```bash
npm install --save @flitz/errors
```

from the folder, where your `package.json` is stored.

## Usage

```javascript
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:

```typescript
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.):

<kbd><img src="https://raw.githubusercontent.com/flitz-js/errors/master/assets/screenshot.jpg" /></kbd>

## TypeScript

TypeScript is optionally supported. The module contains its own [definition files](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html).

## Credits

The module makes use of:

* [Youch!](https://github.com/poppinss/youch) by [Poppinss](https://github.com/poppinss)

## License

MIT © [Marcel Kloubert](https://github.com/mkloubert)

---
_Source: https://npm.io/package/@flitz/errors · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
