Module Design - Error Object
- Designed by: Kunal Mittal
- Version: 1.1 28th. April 1998.
- Overview: This object is called by all other objects, to display errors on the screen. The constructor must assign "isError" to false. It is important that when we implement this we ensure that we have only 1 instance of this object. As errors occurs we should not create more instances of this object. Doing so nullifies the importance of "isError" which is needed so that other objects can detect errors and respond appropriately. (Look at isError() for further details.)
- string errorType: A string containing an error message that is to be displayed on the screen.
- boolean isError: This is set to "true" when an error is displayed. This remains "true" until a call to "isError()" is made, at which time this is reset to false.
public void DrawError(string errorType) Overview: Displays an error message in a pop-up window. Parameters: A string containing the error message to be displayed. Pre-conditions: None. Post-conditions: A pop-up window is opened, containing an error message.We wait for the user to press the "Exit" button before continuing. Algorithm: Display the pop-up window. Play a short beep to alert the user. The user now has to press an "Exit" button (that should exist in the pop-up window) in order to continue. The user will not be allowed to entry any commands and/or select any menu items apart from the help menu until they have clicked on the "Exit" button in the pop-up window. Interaction with other Objects: Can be called by any other object. Error conditions: None. Return Value: None.
public boolean IsError(void) Overview: Allows us to recognize that an error has occurred. Once the object knows that the error has been detected by some other object, it resets it value to false. Parameters: None. Pre-conditions: None. Post-conditions: The value of isError is reset to "false". Algorithm: Reset value of isError to false. Interaction with other Objects: Can be called by any other object. Error conditions: None. Return Value: Returns "true" if an error had occurred and "false" otherwise.