# @borderless/fetch-error-handler

> Error handler for fetch responses, e.g. Cloudflare Workers.

Latest version **1.0.2** (published 2020-06-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @borderless/fetch-error-handler
pnpm add @borderless/fetch-error-handler
yarn add @borderless/fetch-error-handler
bun add @borderless/fetch-error-handler
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-06-21 |
| First published | 2020-05-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 3 |
| Unpacked size | 33.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Blake Embrey |
| Maintainers | blakeembrey |
| Keywords | json, rpc, type, safe, typescript |

## Links

- npm: https://www.npmjs.com/package/@borderless/fetch-error-handler
- Repository: https://github.com/BorderlessLabs/fetch-error-handler
- Issues: https://github.com/BorderlessLabs/fetch-error-handler/issues
- npm.io page: https://npm.io/package/@borderless/fetch-error-handler

## Dependencies (3)

- [escape-html](https://npm.io/package/escape-html.md) ^1.0.3
- [@hapi/accept](https://npm.io/package/@hapi/accept.md) ^5.0.1
- [@types/escape-html](https://npm.io/package/@types/escape-html.md) ^1.0.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.2 (latest) — 2020-06-21
- 1.0.1 — 2020-05-14
- 1.0.0 — 2020-05-14

## README

# Fetch Error Handler

[![NPM version][npm-image]][npm-url]
[![NPM downloads][downloads-image]][downloads-url]
[![Build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]

> Error handler for [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) responses, e.g. Cloudflare Workers.

## Installation

```sh
npm install @borderless/fetch-error-handler --save
```

## Usage

```js
import { compose } from "throwback";
import { errorHandler } from "@borderless/fetch-error-handler";
import { finalHandler } from "@borderless/fetch-final-handler";

const app = compose([get(), post()]);
const req = new Request("/");

const res = await app(req, finalHandler()).catch(
  errorHandler(req, { production: true })
);
```

## TypeScript

This project is written using [TypeScript](https://github.com/Microsoft/TypeScript) and publishes the definitions directly to NPM.

## License

MIT

[npm-image]: https://img.shields.io/npm/v/@borderless/fetch-error-handler.svg?style=flat
[npm-url]: https://npmjs.org/package/@borderless/fetch-error-handler
[downloads-image]: https://img.shields.io/npm/dm/@borderless/fetch-error-handler.svg?style=flat
[downloads-url]: https://npmjs.org/package/@borderless/fetch-error-handler
[travis-image]: https://img.shields.io/travis/BorderlessLabs/fetch-error-handler.svg?style=flat
[travis-url]: https://travis-ci.org/BorderlessLabs/fetch-error-handler
[coveralls-image]: https://img.shields.io/coveralls/BorderlessLabs/fetch-error-handler.svg?style=flat
[coveralls-url]: https://coveralls.io/r/BorderlessLabs/fetch-error-handler?branch=master

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