Exceptions
All languages have some way of representing a breaking error state, or exception, that indicates control flow must be halted. Exceptions may be created and thrown, also known as raised, and later caught, also known as rescued, by some calling code. Budgie refers to these operations as catching and throwing exceptions.
Throwing
The built-in exception class for an output language is represented in Budgie by the exception
command, which receives a single string as input. It can be thrown with the throw
command.
In C#:
In Python:
Catching
All supported languages have some variant of the following three code blocks:
Try: runs some code that might throw an error
Catch: handles any error thrown by the try section
Finally: runs regardless of whether an error was thrown
Each of these are considered their own distinct blocks with a start
and end
in Budgie. The catch
section also takes in the name of a general exception.
In C#:
In Python:
Last updated