The nsIException interface has a toString() method. This method overrides the "native" classinfo toString() that would return "xpconnect wrapped ....". So the behavior looks correct to me.
Summary: Exception when I pass @mozilla.org/js/xpc/Exception;1 object to alert() method → Exception when I pass @mozilla.org/js/xpc/Exception;1 object to alert() method
The point is, the toString method can be anything. There's no reason my JS objects can't just throw when toString() is called on them...
I agree there is no real reason. But I really don't think It's correct to throw exception when I try to convert object to string. I think toString() method is "native" method and it should work always and it shouldn't depend on state of object. I am accustomed so much to the fact that I can "see" object at any time. And when I get exception then I'm confused. I think it's better to return string with error message.
> I think toString() method is "native" method It's not, really... any object can override toString on itself any time it wants to.
i've had domwindows or something related to them throw exceptions when i stringify them. and ie has some properties which throw exceptions when i stringify them.
actually, sometimes i get exceptions from tostring (on instances of Array and Object) just because my global object doesn't like me.
When I use toString() method to "see" object then I don't know often type of object. I should set try/catch instructions when I use toString(). I think it's inconveniently. Maybe I'm wrong and method toString() may throw exception in some cases.
Since any object may override its own toString any time it wishes, toString can in fact do anything at all.
This is an automated message, with ID "auto-resolve01". This bug has had no comments for a long time. Statistically, we have found that bug reports that have not been confirmed by a second user after three months are highly unlikely to be the source of a fix to the code. While your input is very important to us, our resources are limited and so we are asking for your help in focussing our efforts. If you can still reproduce this problem in the latest version of the product (see below for how to obtain a copy) or, for feature requests, if it's not present in the latest version and you still believe we should implement it, please visit the URL of this bug (given at the top of this mail) and add a comment to that effect, giving more reproduction information if you have it. If it is not a problem any longer, you need take no action. If this bug is not changed in any way in the next two weeks, it will be automatically resolved. Thank you for your help in this matter. The latest beta releases can be obtained from: Firefox: http://www.mozilla.org/projects/firefox/ Thunderbird: http://www.mozilla.org/products/thunderbird/releases/1.5beta1.html Seamonkey: http://www.mozilla.org/projects/seamonkey/
confrim Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a1) Gecko/20050909 SeaMonkey/1.1a I still belive toString() shouldn't throw any exception
Brendan, shaver, is there any reason not to mark this bug invalid? There's no way an uninitialized exeption object can do sane toString, imo...
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 8 months ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.