summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-11-28 22:30:06 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-11-28 22:30:06 +0900
commitce6eb592dab38eb802b1da5ebdc440bd40deec0d (patch)
tree8f813e6c85162df0becbe9f62a70892753f7f9d6 /src
parente8f3592314f60ef26e68f7923541e97ca3c58076 (diff)
Added Exception ctor which takes both errNum and errorCode.
Also added DlAbortEx ctor which has same signature with new Exception dtor. Added DL_ABORT_EX3 macro to use added ctor.
Diffstat (limited to 'src')
-rw-r--r--src/DlAbortEx.cc12
-rw-r--r--src/DlAbortEx.h7
-rw-r--r--src/Exception.cc13
-rw-r--r--src/Exception.h3
-rw-r--r--src/RecoverableException.cc9
-rw-r--r--src/RecoverableException.h4
6 files changed, 44 insertions, 4 deletions
diff --git a/src/DlAbortEx.cc b/src/DlAbortEx.cc
index beb6d18d..81490ca4 100644
--- a/src/DlAbortEx.cc
+++ b/src/DlAbortEx.cc
@@ -49,12 +49,18 @@ DlAbortEx::DlAbortEx(const char* file, int line, const std::string& msg,
const Exception& cause):
RecoverableException(file, line, msg, cause) {}
+DlAbortEx::DlAbortEx(const char* file, int line, const std::string& msg,
+ error_code::Value code):
+ RecoverableException(file, line, msg, code) {}
+
DlAbortEx::DlAbortEx
(const char* file, int line, int errNum, const std::string& msg):
RecoverableException(file, line, errNum, msg) {}
-DlAbortEx::DlAbortEx(const char* file, int line, const std::string& msg,
- error_code::Value code):
- RecoverableException(file, line, msg, code) {}
+DlAbortEx::DlAbortEx
+(const char* file, int line, int errNum, const std::string& msg,
+ error_code::Value errorCode)
+ : RecoverableException(file, line, errNum, msg, errorCode)
+{}
} // namespace aria2
diff --git a/src/DlAbortEx.h b/src/DlAbortEx.h
index bf6378e8..7bf4f835 100644
--- a/src/DlAbortEx.h
+++ b/src/DlAbortEx.h
@@ -47,14 +47,19 @@ public:
DlAbortEx(const char* file, int line, const std::string& msg,
const Exception& cause);
+ DlAbortEx(const char* file, int line, const std::string& msg,
+ error_code::Value code);
+
DlAbortEx(const char* file, int line, int errNum, const std::string& msg);
- DlAbortEx(const char* file, int line, const std::string& msg,
+ DlAbortEx(const char* file, int line, int errNum, const std::string& msg,
error_code::Value code);
};
#define DL_ABORT_EX(arg) DlAbortEx(__FILE__, __LINE__, arg)
#define DL_ABORT_EX2(arg1, arg2) DlAbortEx(__FILE__, __LINE__, arg1, arg2)
+#define DL_ABORT_EX3(arg1, arg2, arg3)\
+ DlAbortEx(__FILE__, __LINE__, arg1, arg2, arg3)
} // namespace aria2
diff --git a/src/Exception.cc b/src/Exception.cc
index f1e1f972..9652ce59 100644
--- a/src/Exception.cc
+++ b/src/Exception.cc
@@ -86,6 +86,19 @@ Exception::Exception
errorCode_(error_code::UNKNOWN_ERROR)
{}
+Exception::Exception
+(const char* file,
+ int line,
+ int errNum,
+ const std::string& msg,
+ error_code::Value errorCode)
+ : file_(file),
+ line_(line),
+ errNum_(errNum),
+ msg_(msg),
+ errorCode_(errorCode)
+{}
+
Exception::~Exception() throw() {}
std::string Exception::stackTrace() const
diff --git a/src/Exception.h b/src/Exception.h
index 6166503d..e54b28e0 100644
--- a/src/Exception.h
+++ b/src/Exception.h
@@ -72,6 +72,9 @@ public:
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();
diff --git a/src/RecoverableException.cc b/src/RecoverableException.cc
index 6a380f78..29a0cde9 100644
--- a/src/RecoverableException.cc
+++ b/src/RecoverableException.cc
@@ -64,4 +64,13 @@ RecoverableException::RecoverableException
: Exception(file, line, errNum, msg)
{}
+RecoverableException::RecoverableException
+(const char* file,
+ int line,
+ int errNum,
+ const std::string& msg,
+ error_code::Value errorCode)
+ : Exception(file, line, errNum, msg, errorCode)
+{}
+
} // namespace aria2
diff --git a/src/RecoverableException.h b/src/RecoverableException.h
index 9873758e..6d066b1c 100644
--- a/src/RecoverableException.h
+++ b/src/RecoverableException.h
@@ -52,6 +52,10 @@ public:
RecoverableException
(const char* file, int line, int errNum, const std::string& msg);
+
+ RecoverableException
+ (const char* file, int line, int errNum, const std::string& msg,
+ error_code::Value errorCode);
};
} // namespace aria2