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-catchThe 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-errorThe 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.
Send Message
Send SMS Command. With Twidget, you can send SMS messages to phones using the `Send SMS` command. This functionality varies depending on the provider. Currently, we support Twilio as the SMS provider. To use Twilio for SMS integrations, you will need: - A Twilio account ID - Twilio Auth Token - A Tw...
Return
The `return` command in Twidget is a special command used to halt the current command workflow and immediately return a specified result. This command overrides any subsequent processes and outputs the return result regardless of the rest of the workflow logic. This command is particularly useful fo...
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...
Database
Twidget offers many commands to manage data in your database. Below is a list of the available commands and their functionalities: Get Data. Retrieve an entry from a table. Get Multiple Data. Retrieve multiple entries from a table. Save Data. Save an object to a database table. Save Multiple Data. S...
Text
Twidget offers a variety of commands to manipulate text in various ways. To Uppercase. Converts all characters of the provided text to uppercase. - text: The text to be converted to uppercase. - A text string with all characters in uppercase. To Lowercase. Converts all characters of the provided tex...