Error handling
Try catch statement
By default, if an error was received at the time of the script execution, the script immediately finishes its work. If you want to avoid the termination of the script, you should use the try statement. If an error occurs during the execution of the code inside the try block, the control will pass to the catch block, which must be after try. After the catch keyword, it is necessary to specify the name of the variable of error type, which will contain information about the error. You can use [special functions] (https://gentee.github.io/stdlib/runtime#erriderror-err-int) to get the identifier and error text. If you do not remove the error inside catch with recover or retry, it will be passed on and the script will finish its work.
Recover statement
The recover statement is used inside a catch block to remove the error. This command removes the error information, the script exits the current catch block and continues execution.
Retry statement
The retry statement is used inside a catch block to restart try. This command removes the error information and the script re-executes the corresponding try block.
Last updated