blob: a08b966ed2a8458d77c2ff4021cbfb4c15484a7f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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);
}
}
|