Page Contents
Home > @loopback/context > tryWithFinally
tryWithFinally() function
Try to run an action that returns a promise or a value
Signature:
export declare function tryWithFinally<T>(action: () => ValueOrPromise<T>, finalAction: () => void): ValueOrPromise<T>;
Parameters
| Parameter | Type | Description |
|---|---|---|
| action | () => [ValueOrPromise](/doc/en/lb4/apidocs.context.valueorpromise.html)<T> | A function that returns a promise or a value |
| finalAction | () => void | A function to be called once the action is fulfilled or rejected (synchronously or asynchronously) |
Returns: