Skip to main content
The Deno 2 Release Candidate is here
Learn more

panic-fn

Functional way of throwing errors in JS/TS

Installation

Node

// npm i panic-fn

import { panic } from 'panic-fn';

Deno

import { panic } from 'deno.land/x/panic_fn@v1.0.3/mod.ts';

Usage

// throw new Error() with message
panic('Oops...');

// throw custom error
panic(new SyntaxError('Oops...'));