001 package railo.runtime.util; 002 003 import railo.runtime.PageContext; 004 import railo.runtime.PageSource; 005 import railo.runtime.db.SQL; 006 import railo.runtime.exp.PageException; 007 008 /** 009 * class to get exceptions of different types 010 */ 011 public interface Excepton { 012 013 /** 014 * Field <code>TYPE_ABORT</code> 015 */ 016 public static final int TYPE_ABORT=0; 017 /** 018 * Field <code>TYPE_ABORT_EXP</code> 019 */ 020 public static final int TYPE_ABORT_EXP=1; 021 /** 022 * Field <code>TYPE_APPLICATION_EXP</code> 023 */ 024 public static final int TYPE_APPLICATION_EXP=2; 025 /** 026 * Field <code>TYPE_CASTER_EXP</code> 027 */ 028 public static final int TYPE_CASTER_EXP=3; 029 /** 030 * Field <code>TYPE_CUSTOM_TYPE_EXP</code> 031 */ 032 public static final int TYPE_CUSTOM_TYPE_EXP=4; 033 /** 034 * Field <code>TYPE_DATABASE_EXP</code> 035 */ 036 public static final int TYPE_DATABASE_EXP=5; 037 /** 038 * Field <code>TYPE_EXPRESSION_EXP</code> 039 */ 040 public static final int TYPE_EXPRESSION_EXP=6; 041 /** 042 * Field <code>TYPE_FUNCTION_EXP</code> 043 */ 044 public static final int TYPE_FUNCTION_EXP=7; 045 /** 046 * Field <code>TYPE_LOCK_EXP</code> 047 */ 048 public static final int TYPE_LOCK_EXP=8; 049 /** 050 * Field <code>TYPE_MISSING_INCLUDE_EXP</code> 051 */ 052 public static final int TYPE_MISSING_INCLUDE_EXP=9; 053 /** 054 * Field <code>TYPE_NATIVE_EXP</code> 055 */ 056 public static final int TYPE_NATIVE_EXP=10; 057 /** 058 * Field <code>TYPE_SECURITY_EXP</code> 059 */ 060 public static final int TYPE_SECURITY_EXP=11; 061 /** 062 * Field <code>TYPE_TEMPLATE_EXP</code> 063 */ 064 public static final int TYPE_TEMPLATE_EXP=12; 065 /** 066 * Field <code>TYPE_XML_EXP</code> 067 */ 068 public static final int TYPE_XML_EXP=13; 069 070 /** 071 * create exception "Abort" 072 * @return Abort 073 */ 074 public PageException createAbort(); 075 076 /** 077 * create exception "AbortException" 078 * @param showError 079 * @return AbortException 080 */ 081 public PageException createAbortException(String showError); 082 083 /** 084 * create exception "ApplicationException" 085 * @param message 086 * @return ApplicationException 087 */ 088 public PageException createApplicationException(String message); 089 090 /** 091 * create exception "ApplicationException" 092 * @param message 093 * @param detail 094 * @return ApplicationException 095 */ 096 public PageException createApplicationException(String message, String detail); 097 098 /** 099 * create exception "CasterException" 100 * @param message 101 * @return CasterException 102 */ 103 public PageException createCasterException(String message); 104 105 /** 106 * create exception "CustomTypeException" 107 * @param message 108 * @param detail 109 * @param errorcode 110 * @param customType 111 * @return CustomTypeException 112 * @deprecated use instead <code>createCustomTypeException(String message, String detail, String errorcode, String customType, String extendedInfo);</code> 113 */ 114 public PageException createCustomTypeException(String message, String detail, String errorcode, String customType); 115 116 public PageException createCustomTypeException(String message, String detail, String errorcode, String customType, String extendedInfo); 117 118 /** 119 * create exception "DatabaseException" 120 * @param message 121 * @return DatabaseException 122 */ 123 public PageException createDatabaseException(String message); 124 125 /** 126 * create exception "DatabaseException" 127 * @param message 128 * @param detail 129 * @return DatabaseException 130 */ 131 public PageException createDatabaseException(String message, String detail); 132 133 /** 134 * create exception "DatabaseException" 135 * @param message 136 * @param sql 137 * @return DatabaseException 138 */ 139 public PageException createDatabaseException(String message, SQL sql); 140 141 /** 142 * create exception "ExpressionException" 143 * @param message 144 * @return ExpressionException 145 */ 146 public PageException createExpressionException(String message); 147 148 /** 149 * create exception "ExpressionException" 150 * @param message 151 * @param detail 152 * @return ExpressionException 153 */ 154 public PageException createExpressionException(String message, String detail); 155 156 /** 157 * create exception "FunctionException" 158 * @param pc 159 * @param functionName 160 * @param badArgumentPosition 161 * @param badArgumentName 162 * @param message 163 * @return FunctionException 164 * @deprecated use instead <code>createFunctionException(PageContext pc,String functionName, int badArgumentPosition, String badArgumentName, String message, String detail))</code> 165 */ 166 public PageException createFunctionException(PageContext pc,String functionName, String badArgumentPosition, String badArgumentName, String message); 167 168 /** 169 * create exception "FunctionException" 170 * @param pc 171 * @param functionName 172 * @param badArgumentPosition 173 * @param badArgumentName 174 * @param message 175 * @return FunctionException 176 */ 177 public PageException createFunctionException(PageContext pc,String functionName, int badArgumentPosition, String badArgumentName, String message, String detail); 178 179 /** 180 * create exception "LockException" 181 * @param operation 182 * @param name 183 * @param message 184 * @return LockException 185 */ 186 public PageException createLockException(String operation, String name, String message); 187 188 /** 189 * create exception "LockException" 190 * @param ps 191 * @return LockException 192 */ 193 public PageException createMissingIncludeException(PageSource ps); 194 195 /** 196 * create exception "NativeException" 197 * @param t 198 * @return NativeException 199 */ 200 public PageException createNativeException(Throwable t); 201 202 /** 203 * create exception "SecurityException" 204 * @param message 205 * @return SecurityException 206 */ 207 public PageException createSecurityException(String message); 208 209 /** 210 * create exception "SecurityException" 211 * @param message 212 * @param detail 213 * @return SecurityException 214 */ 215 public PageException createSecurityException(String message, String detail); 216 217 /** 218 * create exception "TemplateException" 219 * @param message 220 * @return TemplateException 221 */ 222 public PageException createTemplateException(String message); 223 224 /** 225 * create exception "TemplateException" 226 * @param message 227 * @param detail 228 * @return TemplateException 229 */ 230 public PageException createTemplateException(String message, String detail); 231 232 /** 233 * create exception "XMLException" 234 * @param message 235 * @return XMLException 236 */ 237 public PageException createXMLException(String message); 238 239 /** 240 * create exception "XMLException" 241 * @param message 242 * @param detail 243 * @return XMLException 244 */ 245 public PageException createXMLException(String message, String detail); 246 247 /** 248 * check if exception is of given type 249 * @param type type to check 250 * @param t exception to check 251 * @return is of type 252 */ 253 public boolean isOfType(int type, Throwable t); 254 }