-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnigmaException.java
More file actions
26 lines (22 loc) · 996 Bytes
/
EnigmaException.java
File metadata and controls
26 lines (22 loc) · 996 Bytes
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
package enigma;
/** A general-purpose error-reporting exception for this package. All
* anticipated user or I/O errors should be reported through this
* exception, with the message being the error message to be printed.
* @author P. N. Hilfinger
*/
class EnigmaException extends RuntimeException {
/** An exception whose getMessage() value is MSG. */
EnigmaException(String msg) {
super(msg);
}
/** A utility method that returns a new exception with a message
* formed from MSGFORMAT and ARGUMENTS, interpreted as for the
* String.format method or the standard printf methods.
*
* The use is thus 'throw error(...)', which tells the compiler that
* execution will terminate at that point, and avoid insistance on
* an explicit return in a value-returning function.) */
static EnigmaException error(String msgFormat, Object... arguments) {
return new EnigmaException(String.format(msgFormat, arguments));
}
}