getStackTrace() is used to keep track of the functions which are invoked by the application at runtime. The method, when called, displays a formatted list of the invoked functions and the .4gl files in which they are located. The method does not require any arguments.
Syntax:
base.Application.getStackTrace()
Usage example:
It is convenient to invoke this method from WHENEVER ERROR or WHENEVER ANY ERROR statements to find out instantly which function caused the error:
MAIN
...
WHENEVER ANY ERROR CALL track_func()
...
END MAIN
FUNCTION track_func()
DISPLAY base.Application.getStackTrace()
END FUNCTION
If an error occurs, the program control goes to the track_func() function which invokes the getStackTrace() method. The output in this case may be similar to this:
track_func() at runner.4gl:50
get_items_list() at items.4gl:321
display_items() at items.4gl:450
search_customer() at customers.4gl:763