Table of Contents Previous Next
Logo
The C++ Utility Library : E.5 Exception
Copyright © 2003-2009 ZeroC, Inc.

E.5 Exception

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;
};
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 remaining member functions are described in Section 6.9.
Table of Contents Previous Next
Logo