Monday, May 12, 2008

Stack Frame

When you use many functions and procedures it can be handy to know where run time error occur.
The class StackFrame allows you to query the calling function.

Example:

Private Function SomeFunction() as Boolean

Try
_balance = -100
Catch ex as Exeption
Throw new Exception("Balance cannot be negative. Function: " & ((New StackFrame).GetMethod.Name), ex)
End Try
End Function


No comments: