tryCatch
Last updated
Handling exceptions (errors) in code execution. It allows you to "try" a block of code, "catch" any errors that occur, and optionally "finally" execute some code regardless of whether an error was thrown or not
N/A
N/A
The functions to be executed.
The functions to be executed when there is an exception.
Returns an error.
Error
The functions to be executed regardless of the exception is thrown or caught.
In this example, we will do console logging by using console function in tryCatch function callback to demonstrate how tryCatch works.
Drag a button component into the canvas and open the Action tab. Select the press event of the button and drag the tryCatch function to the event flow.

Drag the function console to the tryCatch function try callback, on it's value param add try as value.

Drag the function console to the tryCatch function catch callback, on it's value param change the param type to input.

Drag the function console to the tryCatch function catch callback, on it's value param add finally as value.

Now click the button in preview, it will only show try and finally on the console.

See also:
Functions
Last updated
try {
console.log("try")
} catch (e) {
console.log(e)
} finally {
console.log("finally");
}