ApplicationException

  • Thread starter Thread starter OpticTygre
  • Start date Start date
O

OpticTygre

Hey folks,

Building my own exception class that inherits from ApplicationException, but
includes a few extra properties I create, such as IPAddress and such. I
want to define a couple different "New" subroutines to be able to capture
all the elements of the error that happened, and the extra data. Problem
is, it won't let me do:

Public Sub New(ByVal ex as Exception)
Me = ex
End Sub

Or

Public Sub New(ByVal ex as Exception, ByVal IPAddress as String)
Me = ex
m_IPAddress = IPAddress
End Sub

How can I easily set all the properties of the exception passed into my
"TransferException" without setting every single property by hand?

Thanks.

-Jason
 
OpticTygre said:
How can I easily set all the properties of the exception passed into my
"TransferException" without setting every single property by hand?

Instead of setting all the properties add the exception to your exception's
'InnerException' property.
 
Ahh, good idea. Will that InnerException have its own InnerException
property (the InnerException of the original Exception)?
 
OpticTygre said:
Ahh, good idea. Will that InnerException have its own InnerException
property (the InnerException of the original Exception)?

Yes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top