Re: How to catch parser errors?

Michael Vincent van Rantwijk <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xml
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
Michael Vincent van Rantwijk wrote:
> Martin Honnen wrote:
>>
>>
>> Michael Vincent van Rantwijk wrote:
>>
>>
>>> I currently use something like this:
>>>
>>> try {
>>>   someElement.innerHTML = foopydoopy;
>>> } catch(ex) {
>>>  dump(ex);
>>>  >>> [Exception... "An invalid or illegal string was specified"  code: "
>>> 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).
> 
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.