Source for org.relaxng.datatype.DatatypeException

   1: package org.relaxng.datatype;
   2: 
   3: /**
   4:  * Signals Datatype related exceptions.
   5:  * 
   6:  * @author <a href="mailto:jjc@jclark.com">James Clark</a>
   7:  * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
   8:  */
   9: public class DatatypeException extends Exception {
  10:     
  11:     public DatatypeException( int index, String msg ) {
  12:         super(msg);
  13:         this.index = index;
  14:     }
  15:     public DatatypeException( String msg ) {
  16:         this(UNKNOWN,msg);
  17:     }
  18:     /**
  19:      * A constructor for those datatype libraries which don't support any
  20:      * diagnostic information at all.
  21:      */
  22:     public DatatypeException() {
  23:         this(UNKNOWN,null);
  24:     }
  25:     
  26:     
  27:     private final int index;
  28:     
  29:     public static final int UNKNOWN = -1;
  30: 
  31:     /**
  32:      * Gets the index of the content where the error occured.
  33:      * UNKNOWN can be returned to indicate that no index information
  34:      * is available.
  35:      */
  36:     public int getIndex() {
  37:         return index;
  38:     }
  39: }