Javascript discard errors with the relevance of the error object

This is pretty much related to IE, because IE is the environment I use to test this, but I want to know if you can influence the relevance of the properties of the error object on error. Consider the following javascript:

function MyClass (Arg1, Arg2)    // Line 5 of my.js
{
    if (typeof Arg1 != "string")
        throw new Error("Invalid argument passed for MyClass");
    // Do some other stuff here
}

Further on your code you

var myvar = new MyClass(100, "Hello");    // Line 3201 of my.js

Thus, the above would produce an error, but the error reported in the debugging information would show the error that occurs on line 9 of my.js instead of line 3201. Can this be changed using standard methods?

+5
source share
2 answers

, , - . , . js.

+2

firefox , . message.

, stacktrace.

+2

All Articles