Re: How to catch parser errors?

Martin Honnen <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xml
Organization Liberty Development
Message-ID <[email protected]>

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).

-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/
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.