summaryrefslogtreecommitdiff
path: root/src/Exception.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-10-11 15:13:53 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-10-11 15:13:53 +0000
commit4ddc6eac5820fc8ae21254fac68c890e9da5091d (patch)
tree77df052700fd839490f2e187b44c5e536e1c35d6 /src/Exception.cc
parent8bfe35d3f27e5f7f64d7d7ca6c2165eae2ceeb62 (diff)
2010-10-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added errno member variable to Exception. * src/DlAbortEx.cc * src/DlAbortEx.h * src/Exception.cc * src/Exception.h * src/RecoverableException.cc * src/RecoverableException.h
Diffstat (limited to 'src/Exception.cc')
-rw-r--r--src/Exception.cc23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/Exception.cc b/src/Exception.cc
index f53c54b5..1e86b30b 100644
--- a/src/Exception.cc
+++ b/src/Exception.cc
@@ -39,27 +39,30 @@
namespace aria2 {
Exception::Exception(const char* file, int line, const std::string& msg):
- file_(file), line_(line), msg_(msg) {}
+ file_(file), line_(line), errno_(0), msg_(msg) {}
Exception::Exception(const char* file, int line, const std::string& msg,
const Exception& cause):
- file_(file), line_(line), msg_(msg), cause_(cause.copy()) {}
+ file_(file), line_(line), errno_(0), msg_(msg), cause_(cause.copy()) {}
Exception::Exception(const char* file, int line, const Exception& e):
- file_(file), line_(line), msg_(e.msg_), cause_(e.cause_)
+ file_(file), line_(line), errno_(0), msg_(e.msg_), cause_(e.cause_)
{}
-Exception::~Exception() throw() {}
+Exception::Exception
+(const char* file, int line, int errnoArg, const std::string& msg):
+ file_(file), line_(line), errno_(errnoArg), msg_(msg) {}
-const char* Exception::what() const throw()
-{
- return msg_.c_str();
-}
+Exception::~Exception() throw() {}
-std::string Exception::stackTrace() const throw()
+std::string Exception::stackTrace() const
{
std::stringstream s;
- s << "Exception: " << "[" << file_ << ":" << line_ << "] " << what() << "\n";
+ s << "Exception: " << "[" << file_ << ":" << line_ << "] ";
+ if(errno_) {
+ s << "errno=" << errno_ << " ";
+ }
+ s << what() << "\n";
SharedHandle<Exception> e = cause_;
while(!e.isNull()) {
s << " -> " << "[" << e->file_ << ":" << e->line_ << "] "