Hi there,
I am trying to write a simple error handling class and I can't seem to find any kind of samples on the web. I am catching the error like so...(errorhandling being my errorhandling class object)
When I run it as is gives me a casting error with my ctype conversion...?? I can't even get into my error handling class to check if it works! Please, what am I missing here?Code:'class variables Dim errorString As String Dim exh As errorhandling Public Sub.... .....'code ....... Catch ex As Exception trans.Rollback() exh = CType(context.Handler, errorhandling) 'handle(ByVal ex as Exception) is the function which the ecception is passed to in the err handling class errorString = exh.handle(ex) Response.Redirect("Error.aspx?errorMsg=" & errorString) Finally If myConn.State = ConnectionState.Open Then myConn.Close() End If myConn = Nothing End Try
Another thing I'm trying to figure out is how I can access the specific error number? I know that Exceptions have a HResult() method but it's protected and I'm not sure how else I can access the values.
Any help on these issues would be most appreciated.
Cheers.




Reply With Quote