
GetHtmlErrorMessage | 315
HttpException
Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Parameter
Exception
An Exception instance that will be populated by the method.
Example
The following code example creates a set of three nested exceptions, the second
and third of which are created with an overloaded constructor that sets the Inner-
Exception property to the prior exception. The code throws the third exception,
which is caught by the
Catch statement. The Catch block displays the error
message of both the immediate inner exception by using the InnerException prop-
erty and the original exception by using the Message property of the exception
returned by the GetBaseException method:
Sub Page_Load( )
Try
Dim myHttpEx As _
New HttpException("This is the original exception")
Dim myHttpEx2 As _
New HttpException("This is a nested exception", myHttpEx)
Throw New HttpException("Threw an exception from Page_Load", _
myHttpEx2)
Catch HttpEx As HttpException
Dim InnerHttpEx As HttpException
InnerHttpEx = CType(HttpEx.InnerException, HttpException)
Message.Text = "ERROR:<br/>"
Message.Text &= "Message: " & HttpEx.Message & "<br/>"
Message.Text &= "Inner Exception Message: " & _
InnerHttpEx.Message & "<br/>"
Message.Text &= "Base Exception Message: " & _
InnerHttpEx.GetBaseException.Message & "<br/>"
End Try
End Sub
Notes
Like the TargetSite ...