W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2001

RE: DOM 3 Core: Overlap with JAXP, Document order of attributes, getChildElementsByTagName, Exceptions

From: Jeff Yates <PBWiz@mail.pbwizard.com>
Date: Wed, 16 May 2001 02:35:27 -0400
Message-Id: <200105160235.AA211943642@mail.pbwizard.com>
To: <www-dom@w3.org>
If the DOM you are using follows the W3C Recomendation then you use the instanceof operator in JavaScript to find out what exception object was thrown.  After you get that then you use the value of the code property to get the exact error thrown. 

If the DOM you are using follows the W3C Recomendation you can use the following:

    //error prone code
  if( err instanceof DOMException ){
    switch( err.code ){
    case DOMException.INDEX_SIZE_ERR:  //error handling code here
    case DOMException.DOMSTRING_SIZE_ERR:  //error handling code here
    case DOMException.HIERARCHY_REQUEST_ERR:  //error handling code here
    case DOMException.INVALID_ACCESS_ERR:  //error handling code here
  } else if( err instanceof EventException ){
    if( err.code == EventException.UNSPECIFIED_EVENT_TYPE_ERR )
      //error handling code here
  } else if( ... ){

Jeff Yates
e-mail:    PBWiz@PBWizard.com
Homepage:  http://www.PBWizard.com

Received on Wednesday, 16 May 2001 02:35:37 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:08 UTC