ApplicationException

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • OpticTygre

    #1

    ApplicationException

    Hey folks,

    Building my own exception class that inherits from ApplicationExce ption, 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
    "TransferExcept ion" without setting every single property by hand?

    Thanks.

    -Jason


  • Herfried K. Wagner [MVP]

    #2
    Re: ApplicationExce ption

    "OpticTygre " <optictygre@ade lphia.net> schrieb:[color=blue]
    > How can I easily set all the properties of the exception passed into my
    > "TransferExcept ion" without setting every single property by hand?[/color]

    Instead of setting all the properties add the exception to your exception's
    'InnerException ' property.

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://classicvb.org/petition/>

    Comment

    • OpticTygre

      #3
      Re: ApplicationExce ption

      Ahh, good idea. Will that InnerException have its own InnerException
      property (the InnerException of the original Exception)?

      "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
      news:OZOIKpnWFH A.3828@TK2MSFTN GP10.phx.gbl...[color=blue]
      > "OpticTygre " <optictygre@ade lphia.net> schrieb:[color=green]
      >> How can I easily set all the properties of the exception passed into my
      >> "TransferExcept ion" without setting every single property by hand?[/color]
      >
      > Instead of setting all the properties add the exception to your
      > exception's 'InnerException ' property.
      >
      > --
      > M S Herfried K. Wagner
      > M V P <URL:http://dotnet.mvps.org/>
      > V B <URL:http://classicvb.org/petition/>[/color]


      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: ApplicationExce ption

        "OpticTygre " <optictygre@ade lphia.net> schrieb:[color=blue]
        > Ahh, good idea. Will that InnerException have its own InnerException
        > property (the InnerException of the original Exception)?[/color]

        Yes.

        --
        M S Herfried K. Wagner
        M V P <URL:http://dotnet.mvps.org/>
        V B <URL:http://classicvb.org/petition/>

        Comment

        Working...