throwErr

throwErr

Expression form of throw

Import

import { throwErr } from '@fullstacksjs/toolbox';

Signature

function throwErr(err: unknown): never {}

Examples

throwErr('oops')              // throw 'oops'
throwErr(Error('oops'))       // throw Error('oops')
throwErr(CustomError('oops')) // throw CustomError('oops')