throw
Description
Intentionally throw an error. When you throw an error, the normal flow of code execution stops, and control is passed to the nearest catch block, while passing the error message.
Input / Parameter
Name | Description | Input Type | Default | Options | Required |
---|---|---|---|---|---|
value | The error message to throw. | Text/String | - | - | No |
Output
N/A
Callback
N/A
Example
In this example, we will do console logging by using console
and throw
function in tryCatch
function callback to demonstrate how throw
works.
Code Equivalent
Steps
Drag a
button
component into the canvas and open theAction
tab. Select thepress
event of the button and drag thetryCatch
function to the event flow.Drag the function
throw
to thetryCatch
function try callback, on it'svalue
param adderror from throw
as value.Drag the function
console
to thetryCatch
function catch callback, on it'svalue
param change the param type toinput
.Drag the function
console
to thetryCatch
function catch callback, on it'svalue
param addfinally
as value.
Result
Now click the button in preview, it will only show
error from throw
andfinally
on the console.
Links
Related Information
See also:
Last updated