Is it possible to give a name to code that I execute using eval?
When the browser loads a file and executes it, and then the code throws an exception, the browser can tell me in which file at which line the exception happened.
I want that it also can tell me where and in which evaled code an exception happened. It should display the name I gave this code then.
Hope you understand what I want.
Thanks for your help!
Assign your name to a local var right before executing the eval and then wrap the eval in a try/catch. In the catch, you’ll have both the name and the exception.
You can’t get the browser to tell you which line in the eval’d code contains the problem, as the code is treated as one distinct unit, but you can log both the name of the problem code and the problem code itself, as noted above.