From 8f3c9af4bb9edb599bdc6c8da24e74beee4e1bf1 Mon Sep 17 00:00:00 2001 From: Matt Windsor Date: Thu, 17 Feb 2011 23:28:47 +0000 Subject: Initial commit; initial work on the library viewer which can be run either as an applet or an application; database connection is set up to connect to localhost as testing has necessitated using a gSTM SSH tunnel. --- src/uk/org/ury/frontend/FrontendError.java | 50 ++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/uk/org/ury/frontend/FrontendError.java (limited to 'src/uk/org/ury/frontend/FrontendError.java') diff --git a/src/uk/org/ury/frontend/FrontendError.java b/src/uk/org/ury/frontend/FrontendError.java new file mode 100644 index 0000000..a08b966 --- /dev/null +++ b/src/uk/org/ury/frontend/FrontendError.java @@ -0,0 +1,50 @@ +/** + * + */ +package uk.org.ury.frontend; + +import javax.swing.JOptionPane; + +/** + * Factory for descriptive error dialogues. + * + * @author Matt Windsor + * + */ + +public class FrontendError +{ + private final static String FATAL_TITLE = "Unrecoverable Error"; + + private final static String FATAL_PREFIX = + "An unrecoverable error has occurred, and the program must close " + + "immediately.\n" + + "Any unsaved work may have been permanently lost.\n\n" + + "Please let URY Computing know about this error.\n\n" + + "The error message reported was:\n\t"; + + private final static String FATAL_SUFFIX = ""; + + + /** + * Create an error dialogue to report a fatal error. + * + * @string message The message, eg the exception message, + * to report to the user. + */ + + public static void + reportFatal (String message, FrontendFrame frame) + { + // TODO: Log + + // TODO: Replace with bespoke error dialogue? + + JOptionPane.showMessageDialog (frame, + FATAL_PREFIX + message + FATAL_SUFFIX, + FATAL_TITLE, + JOptionPane.ERROR_MESSAGE); + + System.exit (-1); + } +} -- cgit v1.2.3