Haxe allows throwing any kind of value using its
A value which is thrown like this can be caught by
catch blocks. If no such block catches it, the behavior is target-dependent.
It's highly recommended to not throw arbitrary values and instead throw instances of
In fact, if
value is not an instance of
throw value is compiled as
throw haxe.Exception.thrown(value), which wraps
value into an instance of
However native target exceptions are thrown as-is. For example an instance of
php.Exception won't get automatically wrapped upon throwing.