|
| Re: Finding the name of the calling program. |
 |
Wed, 26 Dec 2007 10:08:01 -080 |
Matthew wrote:
> We are using dBase 5.0 for Dos.
>
> We are going to use an error routine in a separate program, but when using
program() in that separate routine we only get the name of the error routine,
not the program/procedure that called it. Is there a way to get the name of the
program that called our error routine? Would it be a scenario where we would
need to pass parameters?
Most likely ... dBASE has not, to the best of my knowledge, kept a stack
of programs that would show the program that called an error routine ...
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
|
| Post Reply
|
| Finding the name of the calling program. |
 |
Wed, 26 Dec 2007 12:56:38 -050 |
We are using dBase 5.0 for Dos.
|
| Post Reply
|
| Re: Finding the name of the calling program. |
 |
Wed, 26 Dec 2007 14:09:32 -080 |
Matt wrote:
> Ken
>
>> Most likely ... dBASE has not, to the best of my knowledge, kept a
stack
>> of programs that would show the program that called an error routine
...
>
> I'd have to agree, I have probably read this language reference I have back
and forth. Though I did encounter something interesting. It looks like something
will output the path (program and line number where it passed control to another
program) to the error. I found this when I broke a program. I think it may be
the complier and supposedly I can output that to a file with the > ( DOS
redirect). But I have been unsuccessful, would you know how to do it?
I would imagine it would be tricky, and may not be worth the effort ...
I haven't worked with the DOS products for a long time ... The online
help in dBASE, however gives this, and I assume most of this
functionality exists in the DOS product:
============================
ON ERROR example
Suppose you have an application management object assigned as the core
property of the global _app object. The following ON ERROR command
specifies a particular method of that object to act as a global error
handler; a method call is a valid statement. It passes all relevant
error information to the method as parameters:
on error _app.core.globalErrorTrap(program(), lineno(), error(), message())
The ON ERROR handler can then display an error message and terminate the
application, like this:
function globalErrorTrap(cProg, nLineno, nError, cMsg)
local c
#define CHAR_CR chr(13)
c = cMsg + CHAR_CR + CHAR_CR + ;
"In: " + cProg + CHAR_CR + ;
"Line: " + nLineno + CHAR_CR + CHAR_CR + ;
"If this error persists, contact program vendor."
msgbox(c, "Unexpected Application Error [" + nError +"]",
16)
quit
============================
Obviously, in the DOS product, the msgbox() function won't exist, but
the rest of that should work ...
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
|
| Post Reply
|
| Re: Finding the name of the calling program. |
 |
Wed, 26 Dec 2007 15:43:01 -050 |
Ken
> Most likely ... dBASE has not, to the best of my knowledge, kept a stack
> of programs that would show the program that called an error routine ...
|
| Post Reply
|
| Re: Finding the name of the calling program. |
 |
Thu, 27 Dec 2007 14:26:28 -080 |
did you try:
program(1)
note the number one parameter...
?
Greg Hill
|
| Post Reply
|
|
|
|
|
|
|
|
|
|