haxe icon indicating copy to clipboard operation
haxe copied to clipboard

[PHP] Redefinition of variable code in subclass is not allowed. Previously declared at haxe._Exception.NativeException

Open filt3rek opened this issue 8 months ago • 5 comments

Hej,

I want to use a custom exception with a code param, but it seems it's yet used in PHP target haxe._Exception.NativeException even if haxe.Exception haven't it in its extern declaration... So this piece of code compile well on all targets excepts on PHP :

@:native( "MyError" )
class Error extends haxe.Exception{
    public var code : Null<Int>;
    public function new( ?code : Null<Int>, ?message : String ){
        super( message );
        this.code = code;
    }
}

class Main {
    public static function main() {
        throw new Error( "Fatal" );
    }
}

Thanks for reading me

filt3rek avatar Mar 27 '25 10:03 filt3rek