Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Catching Exceptions

Status
Not open for further replies.

Laeg

Programmer
Nov 29, 2004
95
IE
How do I find the complete execution path of the following code structure?

Code:
Class MyClass

DBConnect()

Function DBConnect()
Try
	MyDatabase.Connect()
Catch ex as MyCustomException 
	SendErrorEmail(MyDatabase.DBError())
End Try
End Function

Function SendErrorEmail(ByVal AppException as Exception)
	[COLOR=red]' What to email???
	AppException.Message
	AppException.StackTrace[/color]
End Function

End Class
------------------------------------------------------------
Class MyDatabase

	Private _DBError As Exception

	Public ReadOnly Property DBError() As Exception
		Get
		    Return _DBError
		End Get
	End Property

	Function Connect()
		Try
			' Do connection stuff              
		Catch ex as Exception
			_DBError = ex
		End Try
	End Function

End Class

Here ex.stacktrace will show only as far as MyDatabase.Connect rather than MyClass.DBConnect, how do I get the complete calling path?
 
Try;
System.Reflection.MethodBase.GetCurrentMethod.Name
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top