[Project_owners] Debugging errors dynamically
Eric Jung
grimholtz at yahoo.com
Thu Mar 12 13:57:01 PDT 2009
On Thu, Mar 12, 2009 at 5:11 AM, joe ertaba <belaviyo at gmail.com> wrote:
> I want to use *eval *to run JavaScript commands dynamically
>
> It works fine but I cant figure out *error line number* with it.
>
> it seems that it is possible to improve error handling using @
> mozilla.org/js/jsd/debugger-service;1
>
> Can any body help how to use this to execute js dynamically also handling
> errors, an example would be appreciated [?]
>
>
You can get a line number with the Exception.stack and Error.stack
properties For example:
try {
...
...
}
catch (e) {
dump(e + "\n" + e.stack + "\n");
}
or
try {
var foo = "123";
alert(foo);
throw new Error("hi mom!"); // forces catch block to be invoked
}
catch(e) {
dump(e + "\n" + e.stack + "\n");
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mozdev.org/pipermail/project_owners/attachments/20090312/5983d64a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 628 bytes
Desc: not available
URL: <http://www.mozdev.org/pipermail/project_owners/attachments/20090312/5983d64a/attachment.png>
More information about the Project_owners
mailing list