throwing exception from COM and catching it in ASP 
Author Message
 throwing exception from COM and catching it in ASP

I am trying to throw some exception in the component
throw _com_error(E_FAIL);
or
   ICreateErrorInfo *err_inf;
   IErrorInfo *err;
   HRESULT hr;
   hr = CreateErrorInfo(&err_inf);
   err_inf->SetDescription(desc);
   err_inf->QueryInterface(IID_IErrorInfo, (LPVOID FAR*) &err);
      throw _com_error(0, err);

and trying to catch it in the ASP

catch(e)
 {
  res = e.description;
 }

but it gives Out of memory, although I pass desc="blablabla" lets say

Any ideas?



Sat, 10 Jul 2004 23:36:56 GMT  
 throwing exception from COM and catching it in ASP
Never ever throw an exception across COM boundaries. COM component
should return failed HRESULT, and optionally set up IErrorInfo object.
#import-generated smart wrappers convert those failed HRESULTs to C++
exceptions on the client side.

See AtlReportError, CComCoClass::Error
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


Quote:
> I am trying to throw some exception in the component
> throw _com_error(E_FAIL);
> or
>    ICreateErrorInfo *err_inf;
>    IErrorInfo *err;
>    HRESULT hr;
>    hr = CreateErrorInfo(&err_inf);
>    err_inf->SetDescription(desc);
>    err_inf->QueryInterface(IID_IErrorInfo, (LPVOID FAR*) &err);
>       throw _com_error(0, err);

> and trying to catch it in the ASP

> catch(e)
>  {
>   res = e.description;
>  }

> but it gives Out of memory, although I pass desc="blablabla" lets say

> Any ideas?



Sun, 11 Jul 2004 03:40:17 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Catching exceptions thrown from another thread?

2. Does Finally execute try Catch throws an Exception?

3. Unable to catch exception thrown from ActiveX control in an MFC client

4. Unable to catch exception thrown from ActiveX control in an MFC client

5. Help on throwing/catching exceptions

6. How to catch all exceptions thrown?

7. No way to catch exceptions thrown from MFC

8. catching exceptions thrown from web services

9. Throwing com exceptions across process boundaries...

10. throwing exception from COM object's constructor

11. ATL COM DLL :: DllRegisterserver throw exception 0x80029c4a

12. Throw exception from ATL COM for both VB and VC++ client

 

 
Powered by phpBB® Forum Software