JScript throw and error number
Hi All,
I noticed that when hosting a Jscript the error number is always
0x8004005 (E_FAIL), independently of which error code was supplied into
the Error object.
Consider the following code:
throw new Error(100, "Description");
When run in wscript exe it gives 0x8004005 as the error code,
while this snippet (in VBS):
Err.Raise 100, "Source", "Description"
gives me the expected 800A0064.
The same thing happens with manually implemented host -
OnScriptError(
/* [in] */ IActiveScriptError *pscripterror)
{
EXCEPINFO ei; ZeroMemory(&ei, sizeof(ei));
pscripterror->GetExceptionInfo(&ei);
Here - E_FAIL is returned in the scode part of the ei in case of
JScript, while for VBScript everything is fine.
Could anyone explain me how to thorw an erro in jScript in order to get
the intended error code, not E_FAIL?
Thanks in advance.
|