1 40 41 package org.jahia.exceptions.database; 42 43 import java.sql.SQLException ; 44 45 import org.jahia.exceptions.JahiaPersistenceException; 46 47 48 54 public class JahiaDatabaseException extends JahiaPersistenceException { 55 56 57 private SQLException sqlException = null; 58 59 60 private String query = null; 61 62 63 64 77 public JahiaDatabaseException (String message, String query, 78 SQLException ex, int severity) { 79 super ("Database: " + message + " while excuting query [" + query + 80 "]\n SQLException : " + ex.getMessage (), DATABASE_ERROR, severity, ex); 81 sqlException = ex; 82 this.query = query; 83 } 84 85 86 97 public JahiaDatabaseException (String message, SQLException ex, 98 int severity) { 99 super ("Database: " + message + "\n SQLException : " + ex.getMessage (), 100 DATABASE_ERROR, severity, ex); 101 sqlException = ex; 102 } 103 104 105 115 public JahiaDatabaseException (String message, String query, int severity) { 116 super ("Database: " + message + " while executing query [" + query + "]", 117 DATABASE_ERROR, severity); 118 this.query = query; 119 } 120 121 122 130 public JahiaDatabaseException (String message, int severity) { 131 super ("Database: " + message, DATABASE_ERROR, severity); 132 } 133 134 135 143 final public SQLException getSQLException () { 144 return sqlException; 145 } 146 147 148 156 final public String getQuery () { 157 return query; 158 } 159 160 } 161 | Popular Tags |