I need the number of the line where the error occurs within an eval(). When I don’t add any error handling, I get a message like
ReferenceError: "intentionallyError" is not defined. (C:\theWholePath\theJsFile.js#14(eval)#2)
The #2 is the line number within the eval() source-code where the error occurred, so this is exactly what I need! But when I add a Try/Catch block like
marcelb:
I need the number of the line where the error occurs within an eval(). When I don’t add any error handling, I get a message like
ReferenceError: "intentionallyError" is not defined. (C:\theWholePath\theJsFile.js#14(eval)#2)
The #2 is the line number within the eval() source-code where the error occurred, so this is exactly what I need! But when I add a Try/Catch block like
Or try to avoid using eval (eval is evil some people say):
var _form_name
var _method_name
var _m = servoymethod.match(/^globals\.(.*)$/)
if (_m) { // global method
_method_name = _m[1]
if (globals[_method_name) { // if method to call exists
globals[_method_name]()
}
}
else { // form method
_m = servoymethod.match(/^forms\.(.*)\.(.*)$/)
if (_m) {
_form_name = _m[1]
_method_name = _m[2]
if (forms[_form_name][_method_name]) { // if method to call exists
forms[_form_name][_method_name]()
` }
}
}
Yes, thanks Gerardo that does the trick, now I can parse the line number.
To Michel: I agree with you that Eval() is Evil but I get the source-code from the db and I need to create those methods with the solutionModel then and I think it is risky business in both calling-methods?