Error Handling
Handle workflow errors and configure recovery paths.
Recorded with an earlier Twidget interface. Names, control locations and available options may differ; use the linked documentation for current guidance.
Watch tutorial (3:07)
Handle workflow errors and configure recovery paths.
Recorded with an earlier Twidget interface. Names, control locations and available options may differ; use the linked documentation for current guidance.
Watch tutorial (3:07)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.
Realtime commands
Use these commands in endpoints, server functions and events to connect authenticated customers and send live notifications. Start with [Realtime channels](/docs/builder/realtime) to create a channel and choose its audience. Authorize Realtime. Issue a one-use connection ticket for the signed-in cus...
Cache
Cache values let an endpoint, server function or event reuse temporary data. For example, save a product summary for five minutes instead of requesting it from another service every time. A cache is temporary. Keep permanent records in your database and make sure the workflow can obtain the original...
Local Storage
Twidget provides a set of local storage commands that enable interaction with the browser’s `localStorage` API through a no-code interface. These commands are useful for storing, retrieving, and managing key-value data persistently within the current domain context. Purpose. These commands abstract ...
Business connectors
For every command’s inputs, results, examples and common errors, open the [detailed connector reference](/docs/connectors/overview). The command editor’s help button opens its exact reference section. Connect common business apps to your endpoints, server functions and events. Choose an app, connect...
Connector Commands
Connector Commands allow you to integrate Twidget projects with external services such as Google Drive, Slack, OpenAI’s ChatGPT, and many others. These commands provide ready-made actions that communicate with third-party APIs, removing the need to manually create and maintain external HTTP requests...