The C++ Exception Class
This class is at the root of the derivation tree for Ice exceptions and encapsulates functionality that is common to all Ice
and IceUtil
exceptions:
class Exception : public std::exception { public: Exception(); Exception(const char* file, int line); virtual ~Exception() throw(); virtual std::string ice_name() const; virtual void ice_print(std::ostream&) const; virtual const char* what() const throw(); virtual Exception* ice_clone() const; virtual void ice_throw() const; const char* ice_file() const; int ice_line() const; const std::string& ice_stackTrace() const; };
The second constructor stores a file name and line number in the exception that are returned by the ice_file
and ice_line
member functions, respectively. This allows you to identify the source of an exception by passing the __FILE__
and __LINE__
preprocessor macros to the constructor.
The what
member function is a synonym for ice_print
. The default implementation of ice_print
prints the file name, line number, and the name of the exception.
The ice_stackTrace
function returns the full stack trace when the exception was constructed, or an empty string, depending on the value of the Ice.PrintStackTraces
property.
The remaining member functions are described in the C++ Mapping for Exceptions.