diff options
Diffstat (limited to 'src/uk/org/ury/frontend/FrontendError.java')
-rw-r--r-- | src/uk/org/ury/frontend/FrontendError.java | 50 |
1 files changed, 50 insertions, 0 deletions
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); + } +} |