Groups | Blog | Home
all groups > inetserver asp components > november 2003 >

inetserver asp components : Trapping Error Raised by COM object


Nithi Gurusamy
11/12/2003 9:39:56 AM
Dear Group:

If I raise an error in my COM object method, is there a way to trap it in my
ASP code where I created the COM object using Server.CreateObject?

My COM object is working with ADO objects. When there is an error thrown by
an ADO object, I want to raise the same error back to the caller of this COM
object. The caller is my ASP code. I want the "500-100" custom error handler
to be called at the end.

The COM object is developed using VB. Even I tried by removing the "on
error.." error handlers in the COM object code. Nothing works. Only way to
realize the error in the ASP is to pass an errorcode variable by reference
and check it back after the function call returns. If there is an error call
Err.Raise method so that it triggers the "500-100" error handler. But I want
everything to happen automatically. I don't want to call Err.Raise in my ASP
code. I can call Err.Raise inside the COM object.

I hope this is a simple issue. Could never find a similar posting in the
past.

Please help!

Nithi Gurusamy


Cowboy (Gregory A. Beamer)
11/12/2003 12:07:44 PM
On Error Resume Next

Call MyObject.ThisCreatesAnError

If Err.Number <> 0 Then
Response.Write "Error Number: " & Err.Number & "<BR>"
Response.Write "Description: " & Err.Description & "<BR>"
Response.Write "Source: " & "<BR>"
End If

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
[quoted text, click to view]

AddThis Social Bookmark Button