1 package uk.ac.ebi.intenz.webapp.exceptions;
2
3 import java.sql.SQLException;
4
5
6
7
8
9
10
11
12
13
14 public class DatabaseException extends Exception {
15 private SQLException sqlException;
16
17
18
19
20
21
22
23 public DatabaseException(String message, SQLException sqlException) {
24 super(message);
25 this.sqlException = sqlException;
26 }
27
28 public DatabaseException(String message) {
29 super(message);
30 this.sqlException = null;
31 }
32
33
34
35
36
37
38 public DatabaseException(SQLException sqlException) {
39 super("\nIt was not possible to retrieve any information from the database." +
40 "\nPresumably the database server is either too busy or down at the moment" +
41 "\nSorry for any inconvenience this error might have caused.\nPlease try again later.");
42 this.sqlException = sqlException;
43 }
44
45
46
47
48
49
50
51
52 public String getSqlExceptionMessage() {
53 return sqlException.toString();
54 }
55 }