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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you use application or something else to determine current module

Status
Not open for further replies.

SBendBuckeye

Programmer
May 22, 2002
2,166
US
I have some error code I want to put into some procedures to pop a message box for unexpected program results. I would like to include the Module Name and Procedure Name in the message.

Is that information available at runtime so I don't have to hard code it (eg is there a current module in application or project or somewhere equivalent to current control for the forms)? Is there a better way?

Thanks in advance for any help!
 
Sorry, you will have to hard code the module & procedure name into each error handling routine.
If you really wanted you could give each line of code a line number (just put a number followed by a tab at the beginning of each line) and use the erl() function to return the line of code the error occurs.

HTH

Ben ----------------------------------------
Ben O'Hara
Home: bpo@SickOfSpam.RobotParade.co.uk
Work: bo104@SickOfSpam.westyorkshire.pnn.police.uk
(in case you've not worked it out get rid of Sick Of Spam to mail me!)
Web: ----------------------------------------
 
As part of a larger issue, I occassionally generate a 'poor-man's call stack'. It only requires a small routine which is called on the entry (and optionally exit) of each procedure with the procedure's name. Just create an array (or table or text file or ... )to hold the names of the routines (and any ancillary information). Next, write a snipet of code to call the routine with the desired info. Include the procedure name, calling args, ... If you use an array in memory, you really should call a similar routine on exit, to remove the array element. Otherwise the array gets to big and you can easily run out of mem. Likewise, using a table, you will want to empty it on occassion (startup?). I usually include other info, such as a date/time stamp, user name ...

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top