41
41
Exception::Exception(const char* file, int line, const std::string& msg):
42
file_(file), line_(line), msg_(msg) {}
42
file_(file), line_(line), errno_(0), msg_(msg) {}
44
44
Exception::Exception(const char* file, int line, const std::string& msg,
45
45
const Exception& cause):
46
file_(file), line_(line), msg_(msg), cause_(cause.copy()) {}
46
file_(file), line_(line), errno_(0), msg_(msg), cause_(cause.copy()) {}
48
48
Exception::Exception(const char* file, int line, const Exception& e):
49
file_(file), line_(line), msg_(e.msg_), cause_(e.cause_)
49
file_(file), line_(line), errno_(0), msg_(e.msg_), cause_(e.cause_)
53
(const char* file, int line, int errnoArg, const std::string& msg):
54
file_(file), line_(line), errno_(errnoArg), msg_(msg) {}
52
56
Exception::~Exception() throw() {}
54
const char* Exception::what() const throw()
59
std::string Exception::stackTrace() const throw()
58
std::string Exception::stackTrace() const
61
60
std::stringstream s;
62
s << "Exception: " << "[" << file_ << ":" << line_ << "] " << what() << "\n";
61
s << "Exception: " << "[" << file_ << ":" << line_ << "] ";
63
s << "errno=" << errno_ << " ";
63
66
SharedHandle<Exception> e = cause_;
64
67
while(!e.isNull()) {
65
68
s << " -> " << "[" << e->file_ << ":" << e->line_ << "] "