Get Method Name?

I want to get better information on our error logs, specifically, be able to get the name of the method (if any) that was running when the error occured.

Is there a command, plugin, tool, wish… anything you can do to grab the name of the currently active method?

Thanks,

chico

at what point do you want to get that info?
like in a try/catch?

But if you have the try/catch then you already know the method you are in.

I’d like to get the method name inside it, i.e.:

function aMethod()
{
    application.output('The name of this method is:' + ????)
}

Of course, I know the method name now, but if I change it, I have to remember to change the code too.

Hi Juan,

I use the following code to get both the form name and method name:

	/** @type {String} */
	var methodName = controller.getName() + "." + arguments['callee'].name;

but just the last part will give you the method name on it’s own.

Hope this helps
Steve

Thanks, Steve, I found that code, but Servoy shows a warning:

Event parameter is passed to event method; make sure it is used with right type (change method signature).

So I don’t know if that code is a good practice :wink:

That’s odd as I definitely don’t get that warning - I am running Servoy 7.4.6