G
Guest
I need to throw an exception in JScript. According to the ECMA-262
specification this is done as follows:
throw new Error("My error message!");
This works fine for IE on Windows but it doesn't on the Mac OS X plattform.
The JScript Engine insists that the Object Error is not known. As Error is
basic to the ECMA specification it should be available in all
implementations. The funny thing is that the script engine obviously knows
about the Error Object as the following test shows:
try {
eval("abc"); // This produces an error for sure!
} catch(error) {
alert(error);
}
This produces a message box with "[object Error]" as content. Which clearly
shows that the inderictly thrown Exception is of type Error.
So the remaining question is:
If the engine can create Error objects if necessary, why can't my program
using the new statement like "new Error(myMessage)".
If anyone could help on this I'd be really glad.
Thanks
Dagwin
specification this is done as follows:
throw new Error("My error message!");
This works fine for IE on Windows but it doesn't on the Mac OS X plattform.
The JScript Engine insists that the Object Error is not known. As Error is
basic to the ECMA specification it should be available in all
implementations. The funny thing is that the script engine obviously knows
about the Error Object as the following test shows:
try {
eval("abc"); // This produces an error for sure!
} catch(error) {
alert(error);
}
This produces a message box with "[object Error]" as content. Which clearly
shows that the inderictly thrown Exception is of type Error.
So the remaining question is:
If the engine can create Error objects if necessary, why can't my program
using the new statement like "new Error(myMessage)".
If anyone could help on this I'd be really glad.
Thanks
Dagwin