Manish Tewatia

Manish Tewatia

  • 20
  • 48.2k
  • 3.3m

InnerException Error, Plz help..

Aug 15 2010 11:50 AM
Hi Everyone,
Can you plz resolve the error of this code...?

HTML clipboard

Imports System

Imports System.IO

 

Public Class TestInnerException

    Shared Sub Main()

        Try

            Try

                Throw New ArgumentException()

 

            Catch e As ArgumentException

                'make sure this path does not exist

                If File.Exists("\Bigsky\log.txt") = False Then

                    Throw New FileNotFoundException("File Not found when trying to write argument exception to the file", e)

                End If

            End Try

 

        Catch e As Exception

            Console.WriteLine([String].Concat(e.StackTrace, e.Message))

 

            If e.InnerException(Nothing) Then

                Console.WriteLine("Inner Exception")

                Console.WriteLine([String].Concat(e.InnerException.StackTrace, e.InnerException.Message))

            End If

        End Try

        Console.ReadLine()

    End Sub

End Class

Answers (2)