source: tmcsimulator/trunk/src/tmcsim/common/ScriptException.java @ 2

Revision 2, 3.1 KB checked in by jdalbey, 10 years ago (diff)

Initial Import of project files

Line 
1package tmcsim.common;
2
3/**
4 * Exception class used to handle exceptions thrown within
5 * the CAD Simulation software relating to errors caused by simulation
6 * script actions.  Each error is defined by this class' public static
7 * final Strings.
8 *
9 * @author Matthew Cechini
10 * @version
11 */
12@SuppressWarnings("serial")
13public class ScriptException extends Exception {
14           
15    /**
16     * Exception error when user attempts to perform an action but cannot
17     * because a script file has not yet been loaded.<br>
18     * Error Message: "Simulation must have at least one incident loaded."
19     */
20    public static final String NO_SCRIPT_LOADED = "Simulation must have at least one incident loaded.";
21       
22    /**
23     * Exception error when user attempts to perform an action but cannot
24     * because the simulation has not started.<br>
25     * Error Message: "Simulation Not Started"
26     */
27    public static final String SIM_NOT_STARTED = "Simulation must be started.";
28   
29    /**
30     * Exception error when user attempts to delete an incident that has
31     * already occured.<br>
32     * Error Message: "Incident Already Occured"
33     */
34    public static final String INCIDENT_ALREADY_STARTED = "Incident has already occured.";
35   
36    /**
37     * Exception error when user attempts to reschedule an incident to a time that has
38     * already passed.<br>
39     * Error Message: "Time has already passed."
40     */
41    public static final String TIME_PASSED = "Simulation time has already passed.";
42
43    /**
44     * Exception error when user attempts to add an incident that is already in the simualtion. <br>
45     * Error Message: "Duplicate incident number."
46     */
47    public static final String DUPLICATE_INCIDENT = "Duplicate incident number.";
48
49    /**
50     * Exception error during script parsing when an invalid enumeration value parsed.<br>
51     * Error Message: "Invalid enumeration value."
52     */
53    public static final String INVALID_ENUM = "Invalid enumeration value.";
54
55   
56    /**
57     * Constructor accepting a String message.
58     *
59     * @param newMessage Exception message
60     */ 
61    public ScriptException(String newMessage) {
62        super(newMessage);
63    }   
64   
65    /**
66     * Constructor accepting a String message.
67     *
68     * @param newMessage Exception message
69     */ 
70    public ScriptException(String newMessage, Object addlInfo) {
71        super(newMessage + " <" + addlInfo.toString() + ">");
72    }       
73       
74    /**
75     * Constructor accepting a String message and Throwable cause.
76     *
77     * @param newMessage Exception message
78     * @param e Cause of the exception.
79     */ 
80    public ScriptException(String newMessage, Throwable e) {
81        super(newMessage, e);
82    }       
83
84    /**
85     * Constructor accepting a String message, additional info object, and Throwable cause.
86     *
87     * @param newMessage Exception message
88     * @param addlInfo Additional info
89     * @param e Cause of the exception.
90     */ 
91    public ScriptException(String newMessage, Object addlInfo, Throwable e) {
92        super(newMessage + " <" + addlInfo.toString() + ">", e);
93    }       
94   
95       
96}
97   
Note: See TracBrowser for help on using the repository browser.