catch() method from fcf.Actions class
Class:
Package: fcf-framework-core
File: fcf.js
Available from version: 2.0.2
Adds an error handler that is called when an exception occurs or the
When the handler is called when an error occurs, exceptions thrown from the handler are not processed and go out
Arguments
- Error handler function. Function signature:
If the function returns an error object, then subsequent calls to error handlers receive the error that the function returned.
- Sets the parameters of the behavior of the catcher of exceptions.
The parameter can be:
boolean - Iftrue , enablesforce modeobject - An object containing settings:-
boolean force - Iftrue , the handler will be called even if the error was already handled (or ifnoexcept is enabled). -
boolean shadow - If the value istrue , the exception is handled, but the "Exception handler exists" flag is not set. In this case, if no other exception handlers have been added, a warning will be issued indicating that the exception was not handled.
-
Result
- 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);
});
Output:
Error: Some error
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.