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
Parameter | Type |
---|---|
error | unknown |
Returns
never