Skip to content

API reference / @backpack/error-handling / index / throwError

Function: throwError()

ts
function throwError(error): never;

Can be used to throw an error as part of an expression.

Example:

ts
const x = foo.bar ?? throwError("Bar is required!");

Parameters

ParameterType
errorunknown

Returns

never