Haxe allows catching values using its
try try-expr catch(varName1:Type1) catch-expr-1 catch(varName2:Type2) catch-expr-2
If during runtime the evaluation of
try-expression causes a
throw, it can be caught by any subsequent
catch block. These blocks consist of
Haxe allows throwing and catching any kind of value, it is not limited to types inheriting from a specific exception or error class. Catch blocks are checked from top to bottom with the first one whose type is compatible with the thrown value being picked.
This process has many similarities to the compile-time unification behavior. However, since the check has to be done at runtime there are several restrictions: