Hi All,

I currently am using the following in an attempt to catch and display custom
errors (VBScript/Classic ASP):

Private Sub PublishError (number, section, message)
On Error Goto 0
Call Err.Raise(number, section, message)
Err.Clear
End Sub

I then call it something like:
If Not IsObject(i_objConnection) Then PublishError 1, "Database Connection",
"Connection object not initialised"

This works well for me until I try to catch a connection error as below:

On Error Resume Next
i_objConnection.Open strConn

If Err.Number <> 0 Then
PublishError 2, "Database Connection", "A connection to the database
could not be made, check strConn"
End if

The strange thing is that if I Response.Write Err.Source and Err.Description
directly after calling PublishError I get the raised error properties.

I would appreciate a fresh pair of eyes on this, any help appreciated.

Colin

Re: ADO Error catching by Rob

Rob
Tue Aug 17 13:52:19 CDT 2004

Colin Mc Mahon wrote:
> Hi All,
>
> I currently am using the following in an attempt to catch and display custom
> errors (VBScript/Classic ASP):
>
> Private Sub PublishError (number, section, message)
> On Error Goto 0
> Call Err.Raise(number, section, message)
> Err.Clear
> End Sub
>
> I then call it something like:
> If Not IsObject(i_objConnection) Then PublishError 1, "Database Connection",
> "Connection object not initialised"
>
> This works well for me until I try to catch a connection error as below:
>
> On Error Resume Next
> i_objConnection.Open strConn
>
> If Err.Number <> 0 Then
> PublishError 2, "Database Connection", "A connection to the database
> could not be made, check strConn"
> End if
>
> The strange thing is that if I Response.Write Err.Source and Err.Description
> directly after calling PublishError I get the raised error properties.
>
> I would appreciate a fresh pair of eyes on this, any help appreciated.
>
> Colin
>
>
Hi,

I'm no expert on this, but what happens if you "save" Err.Source and
Err.Description before you Responce.Write them ?

Rob