This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Mozilla XML > September 2005 > How to catch parser errors?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How to catch parser errors?
Michael Vincent van Rantwijk

2005-09-04, 7:19 pm

How can I catch parser errors numbers?

I currently use something like this:

try {
someElement.innerHTML = foopydoopy;
} catch(ex) {
dump(ex);[color=darkred]
12" nsresult: "0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)" location: xxx
Line: nnn"] <<<
}

but I don't want to lookup the error code in that string, so how can I
solve this problem?

Thanks,
Michael
Martin Honnen

2005-09-05, 8:04 pm



Michael Vincent van Rantwijk wrote:


> I currently use something like this:
>
> try {
> someElement.innerHTML = foopydoopy;
> } catch(ex) {
> dump(ex);
> 12" nsresult: "0x8053000c (NS_ERROR_DOM_SYNTAX_ERR)" location: xxx
> Line: nnn"] <<<
> }
>
> but I don't want to lookup the error code in that string, so how can I
> solve this problem?


ex is likely an object with properties, look at that in the debugger, it
probably has properties like
ex.result
ex.name
ex.message
ex.lineNumber
ex.columnNumber
which give you the components of that string you see with dump(ex).

--

Martin Honnen
http://JavaScript.FAQTs.com/
Michael Vincent van Rantwijk

2005-09-05, 8:04 pm

Martin Honnen wrote:
>
>
> Michael Vincent van Rantwijk wrote:
>
>
>
> ex is likely an object with properties, look at that in the debugger, it
> probably has properties like
> ex.result
> ex.name
> ex.message
> ex.lineNumber
> ex.columnNumber
> which give you the components of that string you see with dump(ex).


Ugh, I'm only 13 (turn 14 in December) and I don't know s--t about
debuggers (:

Thanks anyway,
Michael
Michael Vincent van Rantwijk

2005-09-05, 8:04 pm

Michael Vincent van Rantwijk wrote:
> Martin Honnen wrote:
>
> Ugh, I'm only 13 (turn 14 in December) and I don't know s--t about
> debuggers (:


Wait a minute, how do the errors/warnings and messages end up in the
console? Let me see...Ah, nsIScriptError.idl might be of help. Great :-)

Michael
Martin Honnen

2005-09-06, 7:28 pm



Michael Vincent van Rantwijk wrote:
[color=darkred]
> Michael Vincent van Rantwijk wrote:
>
[color=darkred]

The interface exposed by ex is likely
<http://www.xulplanet.com/references...IException.html>

As for debugggers, running Venkman, the JavaScript debugger, is not that
difficult, at least if you use an 1.7 release build. Not sure whether
anyone currently takes care of keeping Venkman in shape to run with Deer
Park branch or 1.9 nightly trunks.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews