# RECOVER ### Synopsis Suppress the current error and return a value instead. ### Description This handler allows you to ignore errors and return a value instead. ### Options The following options are supported. - `callback: (error, ...parameters) => T | Promise` _(mandatory)_ The callback must return a value (or Promise) compatible with the return value of the wrapped function. The callback is invoked with the same context as the wrapped function (unless you use an arrow function). - `scope: Class` _(optional)_ Limit the handler to exceptions of the given class (or any subclass thereof). - `predicate: (error, ...parameters) => boolean | Promise` _(optional)_ Dynamically skip invocation of the handler depending on the error thrown or any of the wrapped method's parameters. The predicate is invoked with the same context as the wrapped function (unless you use an arrow function). - `onCallbackError: CallbackErrorAction` _(optional, defaults to `THROW_WRAPPED`)_ This option controls how errors thrown by the callback are handled. - `THROW_WRAPPED`: The error is wrapped in an `MapError`. This is the default. - `THROW`: The error is thrown as-is. - `THROW_TRIGGER`: The error is ignored and the triggering error is thrown instead. ### Example ```typescript class Foo { @HandleError({ action: HandlerAction.RECOVER, callback: () => 42 }) public async doSomething(): Promise { // if something goes wrong, return 42 instead } } ```