aboutsummaryrefslogtreecommitdiff
path: root/src/uk/org/ury/database/exceptions
diff options
context:
space:
mode:
Diffstat (limited to 'src/uk/org/ury/database/exceptions')
-rw-r--r--src/uk/org/ury/database/exceptions/ConnectionFailureException.java44
-rw-r--r--src/uk/org/ury/database/exceptions/MissingCredentialsException.java52
2 files changed, 96 insertions, 0 deletions
diff --git a/src/uk/org/ury/database/exceptions/ConnectionFailureException.java b/src/uk/org/ury/database/exceptions/ConnectionFailureException.java
new file mode 100644
index 0000000..030b24f
--- /dev/null
+++ b/src/uk/org/ury/database/exceptions/ConnectionFailureException.java
@@ -0,0 +1,44 @@
+/**
+ *
+ */
+package uk.org.ury.database.exceptions;
+
+/**
+ * Exception thrown when the database backend fails to connect to
+ * the database server, in absence of a more specific exception.
+ *
+ * @author Matt Windsor
+ */
+
+public class ConnectionFailureException extends Exception
+{
+ /**
+ *
+ */
+ private static final long serialVersionUID = -7353531873142099828L;
+
+
+/**
+ * Construct a new ConnectionFailureException with a
+ * default reason.
+ */
+
+ public
+ ConnectionFailureException ()
+ {
+ super ("Connection failure.");
+ }
+
+
+ /**
+ * Construct a new ConnectionFailureException.
+ *
+ * @param reason The explanation for the exception.
+ */
+
+ public
+ ConnectionFailureException (String reason)
+ {
+ super (reason);
+ }
+}
diff --git a/src/uk/org/ury/database/exceptions/MissingCredentialsException.java b/src/uk/org/ury/database/exceptions/MissingCredentialsException.java
new file mode 100644
index 0000000..2e45526
--- /dev/null
+++ b/src/uk/org/ury/database/exceptions/MissingCredentialsException.java
@@ -0,0 +1,52 @@
+/**
+ *
+ */
+package uk.org.ury.database.exceptions;
+
+/**
+ * Exception thrown when the database credentials required to
+ * log into the URY database under a user class are missing,
+ * and thus the log-in cannot continue.
+ *
+ * The best practice for handling a MissingCredentialsException
+ * is to attempt to log into the database with a less privileged
+ * user class or, if the credentials for read-only access are
+ * missing, give up.
+ *
+ * @author Matt Windsor
+ */
+
+public class MissingCredentialsException extends Exception
+{
+
+ /**
+ *
+ */
+
+ private static final long serialVersionUID = -397479334359858162L;
+
+
+ /**
+ * Construct a new MissingCredentialsException with a
+ * default reason.
+ */
+
+ public
+ MissingCredentialsException ()
+ {
+ super ("Missing credentials.");
+ }
+
+
+ /**
+ * Construct a new MissingCredentialsException.
+ *
+ * @param reason The explanation for the exception.
+ */
+
+ public
+ MissingCredentialsException (String reason)
+ {
+ super (reason);
+ }
+}