/* */ #include "Exception.h" namespace aria2 { Exception::Exception(const std::string& msg):exception(), _msg(msg) {} Exception::Exception(const std::string& msg, const Exception& cause): exception(), _msg(msg), _cause(cause.copy()) {} Exception::Exception(const Exception& e):_msg(e._msg), _cause(e._cause) {} Exception::~Exception() throw() {} const char* Exception::what() const throw() { return _msg.c_str(); } std::string Exception::stackTrace() const throw() { std::string stackTrace = "Exception: "; stackTrace += what(); stackTrace += "\n"; SharedHandle e = _cause; while(!e.isNull()) { stackTrace += " -> "; stackTrace += e->what(); stackTrace += "\n"; e = e->_cause; } return stackTrace; } } // namespace aria2