I'm adding some error (exception) handling to javascript functions, and I'm wondering if there is a way to get the name of the function you're in? eg:
As you can see, I've had to manually set the function name to the variable 'func_name'. It would be cool if I could refer to the function generically somehow.
Does anyone know if this is possible please?
Max Hugen
Australia
Code:
function testError() {
try {
.....
} catch(e) {
var func_name = "testError()";
alert("myWebApp_name - Javascript Error\n\n" +
"Webpage: " + location.pathname.substring(location.pathname.lastIndexOf('/') + 1) + "\n" +
"Function: " + func_name + "\n\n" +
"Error Name: " + e.name + "\n" +
"Error Message: " + e.message);
}
}
Does anyone know if this is possible please?
Max Hugen
Australia