catching exceptions in Javascript thrown from ActiveX control written in C++ -
i've written activex control in c++ throws (c++) exceptions out when error conditions occur within control. javascript code invokes object representing instance of control surrounded try - catch block:
try { var controlinstance = window.controlinstance; ... perform operations on controlinstance ... } catch (e) { alert("something bad happened"); }
now, when run code under ie8 (or 7 or 6) visual studio (2008) debugger attached it, works expected - whether control compiled or without debug on. however, when running browser without debugger attached, ie crashes (really) when exception crosses boundary between control , jscript.
does have suggestions around how solve problem? realize can change control's interface pass exception argument rather not make such change.
any appreciated.
you need atlreporterror. throws javascript exception description string:
stdmethodimp cmyctrl::mymethod() { ... if (bsucceeded) return s_ok; else // hres set disp_e_exception return atlreporterror (getobjectclsid(), "my error message"); }
Comments
Post a Comment