FCF 2.0 development in progress...
> > > > > >
[News] [Packages API] [Downloads] [Donate to the project] [Contacts]

catch() method from fcf.Actions class

fcf.Actions catch(function a_cb)

Package: fcf-framework-core

File: fcf-framework-core:fcf.js

Available from version: 2.0.2

Adds an error handler that is called when an exception occurs or the fcf.Actions.Act.error() method is called in a deferred action.

When the handler is called when an error occurs, exceptions thrown from the handler are not processed and go out


function a_cb
- Error handler function. Function signature:

undefined|Error a_cb (Error a_error)

If the function returns an error object, then subsequent calls to error handlers receive the error that the function returned.

- Self pointer

Example: Function application

let actions = new fcf.Actions(); await actions .then(()=>{ throw new Error("Some error"); }) .catch((a_error)=>{ console.error("Error:", a_error.message); });


Error: Some error