# micro-errors

> A Error Handling for ZEIT's Micro

Latest version **2.0.0** (published 2018-08-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install micro-errors
pnpm add micro-errors
yarn add micro-errors
bun add micro-errors
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2018-08-19 |
| First published | 2018-08-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >7.6.0 |
| Dependencies | 0 |
| Unpacked size | 123.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Shingo Sato |
| Maintainers | sugarshin |
| Keywords | micro, zeit, error, rfc7807 |

## Links

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

## 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

- 2.0.0 (latest) — 2018-08-19
- 1.0.0 — 2018-08-13

## README

# micro-errors

[![CircleCI](https://circleci.com/gh/sugarshin/micro-errors.svg?style=svg&circle-token=1c658fe9da795d5bd72050ca986a9370965bcc7b)](https://circleci.com/gh/sugarshin/micro-errors)
[![npm version][npm-image]][npm-url]

A Error Handling for ZEIT's [Micro](https://github.com/zeit/micro).

```bash
yarn add micro-errors
```

## RFC7807

RFC7807 compliant ref: https://tools.ietf.org/html/rfc7807

## Usage

```js
const { handleErrors, createError } = require('micro-errors')

module.exports = handleErrors({ debug: true })(async (req, res) => {
  throw createError(400, 'Bad Request')
})

// HTTP/1.1 400 Bad Request
// Content-Type: application/problem+json
//
// {
//   "type": "about:blank",
//   "title": "Bad Request",
//   "status": 400,
//   "instance": "/foo/bar",
// }
```

## License

[MIT][license-url]

© sugarshin

[license-image]: https://img.shields.io/:license-mit-blue.svg?style=flat-square
[license-url]: https://sugarshin.mit-license.org/
[npm-image]: https://img.shields.io/npm/v/micro-errors.svg?style=flat-square
[npm-url]: https://www.npmjs.org/package/micro-errors

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