0.1.0 • Published 1 year ago

no-exception v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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

0.1.0

1 year ago

0.0.1

1 year ago