1.0.2 • Published 4 years ago

@borderless/fetch-error-handler v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

Fetch Error Handler

NPM version NPM downloads Build status Test coverage

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

Installation

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

Usage

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 and publishes the definitions directly to NPM.

License

MIT