1 22 23 package org.xquark.xquery.parser; 24 25 public class XQueryException extends Exception { 26 27 28 public static final int NO_CODE = 0; 29 30 public static final int LOAD_TOO_HIGH = 1; 31 32 public static final int PERMISSION_DENIED = 2; 33 34 36 37 protected int errorCode; 38 39 40 protected java.lang.Throwable exception; 41 42 44 48 public XQueryException(int code) { 49 this(code, "",null); 50 } 51 52 56 public XQueryException(java.lang.String msg) { 57 this(XQueryException.NO_CODE, msg, null); 58 } 59 60 65 public XQueryException(int code, java.lang.String msg) { 66 this(code, msg, null); 67 } 68 69 74 public XQueryException(java.lang.String msg, java.lang.Throwable exception) { 75 this(XQueryException.NO_CODE, msg, exception); 76 } 77 78 84 public XQueryException(int code, java.lang.String msg, java.lang.Throwable exception) { 85 super(msg); 86 this.errorCode = code; 87 this.exception = exception; 88 } 89 90 92 96 public int getCode() { 97 return this.errorCode; 98 } 99 100 104 public java.lang.Throwable getException() { 105 return this.exception; 106 } 107 108 109 113 public String getMessage() { 114 String message = super.getMessage(); 115 if ((message == null || message.length() == 0) && this.exception != null) { 116 message = this.exception.getMessage(); 117 } 118 return message; 119 } 120 123 public void printStackTrace() 124 { 125 if (null != this.exception) { 126 this.exception.printStackTrace(); 127 } 128 super.printStackTrace(); 129 } 130 131 134 public void printStackTrace(java.io.PrintWriter pw) 135 { 136 if (null != this.exception) { 137 this.exception.printStackTrace(pw); 138 } 139 super.printStackTrace(pw); 140 } 141 142 145 public void printStackTrace(java.io.PrintStream ps) 146 { 147 if (null != this.exception) { 148 this.exception.printStackTrace(ps); 149 } 150 super.printStackTrace(ps); 151 } 152 } 153 154 155 156 157 158 159 160 161 162 163 164 165 | Popular Tags |