I tried to extend the properties of the JavaScript error through the extension of the prototype error constructor:
<script type="text/javascript"> </script>
Then I test the log function:
<script type="text/javascript> try { var a = b; // b is undefined! } catch(error) { log(error); } </script>
As a result, the error object shows only some properties (for example, in Firefox fileName , lineNumber and columnNumber ), for example, if it has not been extended.
But the strangest thing is that the for...in loop seems unable to execute all the properties of the error object : an attempt to warn the standard error.message property usually returns a message.
So, the results of my test:
- The error constructor does not expand through its prototype, as other native constructors:
- the
for...in loop is not capable of executing the properties of the error object.
I'm right?
Is there any interesting evidence / resources you can offer to learn more about this?
source share