Skip to content

API reference / @backpack/error-handling / promises / onFailure

Function: onFailure()

ts
function onFailure(errorConsumer): (error) => never;

Executes the given callback if failed, letting the original error pass through.

Can be applied on the .catch() method of a Promise to introduce a side effect (such as logging the error).

Parameters

ParameterType
errorConsumer(error) => void

Returns

ts
(error): never;

Parameters

ParameterType
errorunknown

Returns

never