From: Kevin Puetz PuetzKevinA@JohnDeere.com
Unless the callee provided its own Description (e.g. via SetErrorInfo) VBscript maps certain well-known HRESULT values into its own error facility and messages, changing Err.Number and also setting Err.Source to itself (unless already provided, in which case it is left alone)
e.g. if the invoked method returns E_NOINTERFACE, The VBScript Err object should show
Err.Number: 0x1AE Err.Source: Microsoft VBScript runtime error Err.Description: Class doesn't support Automation
Rather than the original HRESULT
Err.Number: 0x80004002 --- dlls/vbscript/vbdisp.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/dlls/vbscript/vbdisp.c b/dlls/vbscript/vbdisp.c index 1c6f68255bd..ae4f3aaf783 100644 --- a/dlls/vbscript/vbdisp.c +++ b/dlls/vbscript/vbdisp.c @@ -1654,6 +1654,15 @@ HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, DISPPARAMS *dp, if(hres == DISP_E_EXCEPTION) { clear_ei(&ctx->ei); ctx->ei = ei; + if(!ctx->ei.bstrDescription) { + ctx->ei.scode = hres = map_hres(ei.scode); + if(HRESULT_FACILITY(hres) == FACILITY_VBS) { + ctx->ei.bstrDescription = get_vbscript_error_string(hres); + if(!ctx->ei.bstrSource) { + ctx->ei.bstrSource = get_vbscript_string(VBS_RUNTIME_ERROR); + } + } + } hres = SCRIPT_E_RECORDED; } return hres;