Error Handling

Try, Catch, and Throw

GDScript does not have built-in support for try-catch blocks. There are many godot-proposals from people asking for it, however, It has already been stated that try-catch will never come into gdscript.

Assert

The assert statement is used to check if a condition is true, and if not, raise an error:

assert(x > 0, "x must be positive")
Comments