/* */ #ifndef D_EXCEPTION_H #define D_EXCEPTION_H #include "common.h" #include #include "SharedHandle.h" #include "error_code.h" namespace aria2 { class Exception:public std::exception { private: const char* file_; int line_; // This is low-level system error code, typically errno in Linux. int errNum_; std::string msg_; // This is application-level error code. error_code::Value errorCode_; // Exception that this object wraps. Normally this cause_ is the // root cause of this exception. SharedHandle cause_; protected: virtual SharedHandle copy() const = 0; public: Exception(const char* file, int line, const std::string& msg); Exception(const char* file, int line, const std::string& msg, error_code::Value errorCode, const Exception& cause); // errorCode_ is initializedwith cause.errorCode_. Exception(const char* file, int line, const std::string& msg, const Exception& cause); Exception(const char* file, int line, const std::string& msg, error_code::Value errorCode); Exception(const char* file, int line, int errNum, const std::string& msg); Exception(const char* file, int line, int errNum, const std::string& msg, error_code::Value errorCode); virtual ~Exception() throw(); virtual const char* what() const throw(); std::string stackTrace() const; int getErrNum() const { return errNum_; } error_code::Value getErrorCode() const { return errorCode_; } }; } // namespace aria2 #endif // D_EXCEPTION_H