Try/Catch Section (Section) — DiSky

Addon: DiSky · Category: Section · Since: 4.8.0

Syntax

try

Description

Execute a block of code and catch any DiSky runtime exceptions that occur. The `try` section runs its code; if any DiSky error is thrown, execution jumps to the `catch` section. The caught exception is stored in the provided variable. Add `and stop` to the catch clause to halt further execution after handling the error.

Examples

try:
    retrieve user with id "invalid" and store it in {_user}
catch {_err} and stop:
    reply with "An error occurred: %{_err}%"

View source