In the haxe manual https://haxe.org/manual/expression-cast-safe.html > The Haxe compiler guarantees that an exception of type String is thrown in this case. But nothing happens on SWF-target https://try.haxe.org/#9c38D