Skip to content

Commit

Permalink
fix cast error if Std.string fails
Browse files Browse the repository at this point in the history
  • Loading branch information
ncannasse authored Mar 12, 2024
1 parent 52888e2 commit e3612d3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions std/js/Boot.hx
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,10 @@ class Boot {
@:ifFeature("typed_cast") private static function __cast(o:Dynamic, t:Dynamic) {
if (o == null || __instanceof(o, t))
return o;
else
throw "Cannot cast " + Std.string(o) + " to " + Std.string(t);
else {
var str = try Std.string(o) catch( e : Dynamic ) (cast o : String);
throw "Cannot cast " + str + " to " + Std.string(t);
}
}

static var __toStr:js.lib.Function;
Expand Down

0 comments on commit e3612d3

Please sign in to comment.