way cool.

 thx.




Patrick Niemeyer <pat@pat.net>
Sent by: beanshell-users-admin@lists.sourceforge.net

07/14/2004 10:47 AM

To
Michael Pitoniak <michael_pitoniak@symantec.com>
cc
beanshell-users@lists.sourceforge.net
Subject
Re: [Beanshell-users] Capture BSH Command Name?






On Jul 14, 2004, at 9:30 AM, Michael Pitoniak wrote:

>  I have a bunch of imported commands, each which captures an Exception
> if there is a problem. Is the a way I can programatically capture the
> command name so I can display it in the Exception? Presently each
> imported command has to display it's name individually, and I would
> like to be able to share one Exception handler for every imported
> command.
>

The name of the current namespace will be the current BeanShell method.
e.g.

  print( this.namespace.getName() );

You can get also get the file and line no info... The invocation line
should indicate the command.  This is an excerpt from the bsh test
harness:

                print(
                        "Test FAILED: "
                        +"Line: "+ this.namespace.getInvocationLine()
                        +" : "+this.namespace.getInvocationText()
                        +" : while evaluating file:
"+getSourceFileInfo()
                );


Pat