class GException

Exception class.

Public Methods

[more] GException(const char *cause, const char *file=0, int line=0, const char *func=0)
Constructs a GException.
[more] GException(const GException & exc)
Copy Constructor.
[more] GException()
Null Constructor.
[more]virtual ~GException(void)
Destructor.
[more]GException& operator=(const GException & exc)
Copy Operator.
[more]void perror(const char *msg = 0) const
Prints an error message on stderr.
[more]const char* get_cause(void) const
Returns the string describing the cause of the exception.
[more]const char* get_function(void) const
Returns the function name from which the exception was thrown.
[more]const char* get_file(void) const
Returns the file name from which the exception was thrown.
[more]int get_line(void) const
Returns the line number from which the exception was thrown.


Documentation

Exception class. The library always uses macros TRY, THROW, CATCH and ENDCATCH for throwing and catching exceptions (see GException.h). These macros only deal with exceptions of type GException.
o GException(const char *cause, const char *file=0, int line=0, const char *func=0)
Constructs a GException. This constructor is usually called by macro THROW. Argument cause is a plain text error message. As a convention, string "EOF" is used when reaching an unexpected end-of-file condition and string "STOP" is used when the user interrupts the execution. The remaining arguments are usually provided by the predefined macros __FILE__, __LINE__, and (G++ and EGCS only) __PRETTY_FUNCTION__.

o GException(const GException & exc)
Copy Constructor.

o GException()
Null Constructor.

ovirtual ~GException(void)
Destructor.

oGException& operator=(const GException & exc)
Copy Operator.

ovoid perror(const char *msg = 0) const
Prints an error message on stderr.
Parameters:
msg - : string incorporated into the error message.

oconst char* get_cause(void) const
Returns the string describing the cause of the exception. The returned pointer is never null. Exception handlers should not rely on the value of the string cause. As a convention however, string "EOF" is used when reaching an unexpected end-of-file condition and string "STOP" is used when the user interrupts the execution. These strings can be tested by the exception handlers. Similar conventional strings may be defined in the future. They all will be small strings with only uppercase characters.

oconst char* get_function(void) const
Returns the function name from which the exception was thrown. A null pointer is returned if no function name is available.

oconst char* get_file(void) const
Returns the file name from which the exception was thrown. A null pointer is returned if no file name is available.

oint get_line(void) const
Returns the line number from which the exception was thrown. A zero is returned if no line number is available.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java