Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dealing with inner exceptions
Message
De
22/04/2013 10:44:35
 
 
À
22/04/2013 10:13:39
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01571592
Message ID:
01571596
Vues:
36
>I am adding support to get the inner exceptions, when we have such a situation.
>
>So, in regular cases, the code goes in here:
>
>
>                ' If we had an error
>                If Not oServer.GetLastError() Is Nothing Then
>                    loError = oServer.GetLastError().GetBaseException()
>                    lcError = Trim(loError.Message) + "1"
>                    lcStackTrace = loError.StackTrace
>
>                    ' If we have an exception
>                    If Not loError.InnerException Is Nothing Then
>                        lcError = lcError + "2"
>                        'lcError = lcError + oApp.GetInnerException(loError.InnerException)
>                    End If
>
>                End If
>
>
>From my application, I have forced an error like this:
>
>
>            Try
>                loRow = loData.oRows(0)
>            Catch ex As Exception
>                Throw New Exception("Ok, here is the exception", ex.InnerException)
>            End Try
>
>
>So, the first one is an "Object reference not found".
>The second one is "Ok, here is the exception".
>
>But, in my error handling, I still only get the last exception, identified here by "Ok, here is the exception1". I would have expected to get that line followed by "2" as this is what I put temporary in my code to look up the chain of exception.
>
>Anyone would know why it does not recognize that there is another level higher in the chain?

Shouldn't it be :
Throw New Exception("Ok, here is the exception", ex)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform