lancehalberd
June 24th, 2007, 11:06 PM
Hello,
I would like to extend Error to add some desired functionality to it, but I've run into a couple of funny issues:
I call the new class DetailedError. If I have code like this:
try{
throw new DetailedError(...);
}catch(e:DetailedError){
}
The catch statement is not executed, though it does work if I just set e as "Error". Unfortunately, one of the things I do in DetailedError is override the toString method, and when I call toString on e, it uses the Error toString method.
This brings me to the second oddity. When I try to use the modifier override on the toString method, I get an error saying I must override a method, as if Error does not have a toString method, though it clearly does.
I'm pretty new to AS 3, so I'm probably missing some obvious things (like the fact that Error is at the top level may give it some special status regarding extending it etc.)
Any help on this would be appreciated.
I would like to extend Error to add some desired functionality to it, but I've run into a couple of funny issues:
I call the new class DetailedError. If I have code like this:
try{
throw new DetailedError(...);
}catch(e:DetailedError){
}
The catch statement is not executed, though it does work if I just set e as "Error". Unfortunately, one of the things I do in DetailedError is override the toString method, and when I call toString on e, it uses the Error toString method.
This brings me to the second oddity. When I try to use the modifier override on the toString method, I get an error saying I must override a method, as if Error does not have a toString method, though it clearly does.
I'm pretty new to AS 3, so I'm probably missing some obvious things (like the fact that Error is at the top level may give it some special status regarding extending it etc.)
Any help on this would be appreciated.