Re: Writing Debug Messages to the Javascript Console
Nathan,
Thanks. I couldn't get that to work. I get
Permission denied to get property UnnamedClass.cl asses
I think that service is intended for XUL applications. Is there no
way to write to it with JavaScript? There's a filter for 'messages
only' in the JavaScript Console itself, so it seems to want to be
written to.
Ion
var message = "Hello, world!";
setTimeout(mess age, 0);
since "Hello, world!" isn't resolvable as a method call, this gets
logged as an error [I get 'Missing ; before statement', but it would
probably be different for a single word message.]
Re: Writing Debug Messages to the Javascript Console
On Thu, 07 Apr 2005 20:02:37 +0200, ion <ionFreeman@gma il.com> wrote:
[color=blue]
> Is there a way to write messages to the javascript console? Like a
> debug.write() method?[/color]
Re: Writing Debug Messages to the Javascript Console
ion wrote:[color=blue]
> Hi!
> Is there a way to write messages to the javascript console? Like a
> debug.write() method?
> Thanks!
> Ion[/color]
The best way to write to debug console is the follwoing:
throw new Error("An error occured bla-bla...")
Note, that using this construction will cause an error alert in IE
browser, and will write to javascript console in Mozilla-based
browsers.
In both cases the script flow will be interrupted after the error
arisen.
Re: Writing Debug Messages to the Javascript Console
Thomas,
Thanks! If I caught the errors, they wouldn't be logged. The funny
thing about the 1.5 Guide's discussion of exception handling is that
they put a function 'logMyErrors' in the catch block, without giving an
implementation. All I want to do, of course, is log errors, so there
you are.
setTimeout is working great for me.
Ion
Thomas 'PointedEars' Lahn wrote:[color=blue]
> ion wrote:
>[color=green]
> > Thanks! I don't want to leave the method body, is why I'm not
> > throwing errors.[/color]
>
> Theoretically, you could re-catch the exception thrown, see
> the JavaScript 1.5 Guide and/or Reference for details.
>
> <http://web.archive.org/devedge.netscap e.com/central/javascript/>
>
>
> PointedEars[/color]
Re: Writing Debug Messages to the Javascript Console
Thomas,
Thanks! If I caught the errors, they wouldn't be logged. The funny
thing about the 1.5 Guide's discussion of exception handling is that
they put a function 'logMyErrors' in the catch block, without giving an
implementation. All I want to do, of course, is log messages, so there
you are.
setTimeout is working great for me.
Ion
Thomas 'PointedEars' Lahn wrote:[color=blue]
> ion wrote:
>[color=green]
> > Thanks! I don't want to leave the method body, is why I'm not
> > throwing errors.[/color]
>
> Theoretically, you could re-catch the exception thrown, see
> the JavaScript 1.5 Guide and/or Reference for details.
>
> <http://web.archive.org/devedge.netscap e.com/central/javascript/>
>
>
> PointedEars[/color]
Comment