When building applications with Twidget, you may encounter situations where you need to handle errors gracefully to ensure your application runs smoothly. Twidget provides two powerful commands for error handling: try-catch
and throw-error
. This documentation will guide you on how to use these commands effectively.
-
try-catch
The try-catch
command is used to handle exceptions that may occur during the execution of your application. This command allows you to execute a block of commands (try
block) and provide a mechanism to handle any exceptions (catch
block).
The try block will automatically create an error variable, this variable holds the error message and sometimes other information.
Optionally, you can include a finally
block to execute code regardless of whether an exception was thrown or not.
throw-error
The throw-error
command is used to explicitly throw an error in your application. This can be useful if you want to enforce certain conditions and notify that something went wrong when those conditions are not met.
try-catch
: A command to handle exceptions, execute commands conditionally on error, and optionally run final commands regardless of error outcome.
throw-error
: A command to explicitly throw an error, which can then be caught and handled using try-catch
.
By utilizing these error commands, you can ensure your Twidget application handles errors gracefully and continues to provide a smooth user experience.
Conversion
Overview. Twidget's conversion commands allow you to easily convert different data types to the required format. Below is a list of the available conversion commands and examples of how to use them. The `Convert to Text` command converts the provided value to a text (string) format. Examples: - `123...
Loops
In Twidget, loops allow you to execute commands multiple times, either based on a condition or through a set number of iterations. Loops can also be nested, meaning you can run loops within other loops, creating complex logic for your tasks. List Loop. The `List Loop` command enables you to loop thr...
Miscellaneous
Twidget provides several miscellaneous commands to facilitate various tasks. Is Null. Description: Checks whether the provided value is null or not. Inputs: - value: The value to be checked. Output: - boolean: Returns `true` if the value is null; otherwise, returns `false`. Not Null. Description: Ch...
Conditionals
Condition Command. The Condition Command allows you to perform actions based on whether an expression evaluates to true or false. You can nest other commands within the true or false branches of the condition, enabling complex logic flows. - Expression Builder: Validate two variables to equal true. ...
Managing Files
Twidget offers a set of commands to manipulate files in your file store. Below are the descriptions and usage of each command to help you understand how to utilize them effectively. Get File. Retrieve a file via file path. Inputs: - `path`: The file path to retrieve the file from. Outputs: - `filena...