no-exception
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

no-exception

Library that implements a crash early, crash hard approach to handling unexpected failure conditions.

Usage

Inspired by Austral's approach to error handling, no-exception automatically registers event handlers for known events indicating unexpected failure conditions. The goal of these handlers is to surface the offending errors and to force a restart / reload of the entire application to ensure a consistent internal state; this is achieved by either crashing the process (for server-side runtimes) or rendering the error into an overlay that visually takes over the page (for browsers).

import 'no-exception';

The format object is a dictionary of serializers that allows developers to customize the message that is presented when crashing the application.

import { format } from 'no-exception';

format.head = (err: any): string => 'main error summary';
format.text = (err: any): string => 'detailed error message';

License

MIT

/no-exception/

    Package Sidebar

    Install

    npm i no-exception

    Weekly Downloads

    23

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    13.2 kB

    Total Files

    12

    Last publish

    Collaborators

    • jacoscaz