|
|
The Error class is a superset of StatusMsg responsible for handling error messages which can have different levels of severity. This class gives an easy object oriented way of handling errors within a program and is found to be much easier to deal with compared to exceptions.
Chances are all error messages within a program will want to be directed to one particular output and have the same header, therefore the Error ostream and error message header has been defined as global. This allows for the ability to easily redefine the location of error outputs for all Error objects with just one method call to setOutput .
|
Set Error to default header. The header size is automatically assigned with the length of the hdr string, and by default creation this object is assigned the ErrLevel of SUCCESS which has an error number of 0.
Parameters:
hdr | Default header |
border | Default header border |
See also: StatusMsgs, StatusMsg
|
Copy constructor
Error& |
Copy assignment which has the special purpose of making sure that if an error exists in the original or new object, then the error with the greatest severity is maintained.
operator |
[const]
Conversion operator to return error status for assignments requiring a boolean value. A way to understand this operator is for example "if(!err)" is "if no error then" and "if(err)" is "if error then".
Returns: true if error and false otherwise
operator |
[const]
Conversion operator to return the error number for assignments requiring an integer value. This is very useful in returning the error status of a program at termination.
Returns: Error status number (Success = 0 or Error > 0)
operator |
[const]
Conversion operator to return the error level for assignments requiring an enum ErrLevel value. This is neccessary for doing compare expression with ErrLevel values, such as "if(err == MINOR) {...}".
see ErrLevel
Returns: Error level
void |
This method allows for "err(ErrLevel,message)" operations to specify the error message along with an error level, or if a message argument is not available, it instead only updates the current error level along with actions. This method takes different actions depending on the ErrLevel passed to it:
SUCCESS : Sets object to original successful state. MINOR : If msg argument exists, it sets the status message body. Then it sets or updates the error number to MINOR. MAJOR : If msg argument exists, it sets the status message body. Then it sets or updates the error number to MAJOR. Also it ends up printing the message body. CRITICAL: If msg argument exists, it sets the status message body. Then it prints the status message body along with the system error message as the argument. It then causes the program to exit immediately with the system error number. |
Parameters:
level | Set or update priority level of error message |
msg | Main message of error (default: previous message) |
arg | Message argument of error (default: no argument) |
out | ostream to output onto (default: global variable eout) |
void |
Same as above but handles an unsigned character for the argument
void |
Same as above but handles a character for the argument
void |
Same as above but handles an unsigned integer for the argument
void |
Same as above but handles an integer for the argument
void |
Same as above but handles an unsigned long for the argument
void |
Same as above but handles a long for the argument
void |
This overload operator is basically the same as the one above, except this one is geared more towards lazy people who do not need to specify priority levels of error messages. The error level will default to MAJOR which is usually the most used error type.
Parameters:
msg | Main message of error |
arg | Message argument of error (default: no argument) |
out | ostream to output onto (default: global variable eout) |
void |
Same as above but handles an unsigned long for the argument
void |
Same as above but handles an integer for the argument
void |
Same as above but handles an unsigned integer for the argument
void |
Same as above but handles a character for the argument
void |
Same as above but handles an unsigned character for the argument
void |
Same as above but handles character string for the argument.
void |
[static]
This method can be called either by an object or directly within the class by "Error::setOuput(ostream)". This powerful method changes the output ostream for all Error objects.
Parameters:
newout | New ostream for all error message outputs |
void |
[static]
This method can be called either by an object or directly within the class by "Error::setHeader(header)". This powerful method changes the header and/or boarder for all Error objects.
Parameters:
newheader | New header |
newboarder | New header boarder |
Reimplemented from StatusMsg.
Generated on Fri Mar 9 02:04:42 2001, using kdoc 2.0a43. |