On Thu, Mar 12, 2009 at 5:11 AM, joe ertaba <[email protected]> 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");
}

<<329.png>>

_______________________________________________
Project_owners mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/project_owners

Reply via email to