mirror of https://github.com/aria2/aria2
2006-12-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To know root cause of exception: * src/Exception.h (cause): New variable. (Exception): Added a parameter. (getMsg): Return const reference to msg. (getCause): New function. * src/DlRetryEx.h (DlRetryEx): Added a parameter 'cause'. Added an overloaded constructor. (DlAbortEx): Added a parameter 'cause'. Added an overloaded constructor. * src/SimpleLogger.cc (writeLog): Log nested exception messages recursively.pull/1/head
parent
ff3ab41b18
commit
458cc27462
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2006-12-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
To know root cause of exception:
|
||||
|
||||
* src/Exception.h
|
||||
(cause): New variable.
|
||||
(Exception): Added a parameter.
|
||||
(getMsg): Return const reference to msg.
|
||||
(getCause): New function.
|
||||
* src/DlRetryEx.h
|
||||
(DlRetryEx): Added a parameter 'cause'.
|
||||
Added an overloaded constructor.
|
||||
(DlAbortEx): Added a parameter 'cause'.
|
||||
Added an overloaded constructor.
|
||||
* src/SimpleLogger.cc
|
||||
(writeLog): Log nested exception messages recursively.
|
||||
|
||||
2006-11-20 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
* src/DefaultBtProgressInfoFile.cc
|
||||
|
|
1
TODO
1
TODO
|
@ -20,3 +20,4 @@
|
|||
* Add Turkish translation.
|
||||
* Add the message like "you can resume the transfer by invoking aria2 again" when the download stops.
|
||||
* Add --bt-timeout command line option.
|
||||
* Fix DefaultBtProgressInfoFile.cc: save(), load()
|
|
@ -38,13 +38,21 @@
|
|||
|
||||
class DlAbortEx:public Exception {
|
||||
public:
|
||||
DlAbortEx():Exception() {}
|
||||
DlAbortEx(Exception* cause = 0):Exception(cause) {}
|
||||
|
||||
DlAbortEx(const char* msg, ...):Exception() {
|
||||
va_list ap;
|
||||
va_start(ap, msg);
|
||||
setMsg(string(msg), ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
DlAbortEx(Exception* cause, const char* msg, ...):Exception(cause) {
|
||||
va_list ap;
|
||||
va_start(ap, msg);
|
||||
setMsg(string(msg), ap);
|
||||
va_end(ap);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _D_DL_ABORT_EX_H_
|
||||
|
|
|
@ -38,13 +38,21 @@
|
|||
|
||||
class DlRetryEx:public Exception {
|
||||
public:
|
||||
DlRetryEx():Exception() {}
|
||||
DlRetryEx(Exception* cause = 0):Exception(cause) {}
|
||||
|
||||
DlRetryEx(const char* msg, ...):Exception() {
|
||||
va_list ap;
|
||||
va_start(ap, msg);
|
||||
setMsg(msg, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
DlRetryEx(Exception* cause, const char* msg, ...):Exception(cause) {
|
||||
va_list ap;
|
||||
va_start(ap, msg);
|
||||
setMsg(msg, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _D_DL_RETRY_EX_H_
|
||||
|
|
|
@ -46,15 +46,21 @@ class Exception {
|
|||
private:
|
||||
string msg;
|
||||
protected:
|
||||
Exception* cause;
|
||||
|
||||
void setMsg(const string& msgsrc, va_list ap) {
|
||||
char buf[256];
|
||||
vsnprintf(buf, sizeof(buf), msgsrc.c_str(), ap);
|
||||
msg = buf;
|
||||
}
|
||||
public:
|
||||
Exception() {}
|
||||
Exception(Exception* cause = 0):cause(cause) {}
|
||||
|
||||
virtual ~Exception() {}
|
||||
string getMsg() { return msg; }
|
||||
|
||||
const string& getMsg() const { return msg; }
|
||||
|
||||
Exception* getCause() const { return cause; }
|
||||
};
|
||||
|
||||
#endif // _D_EXCEPTION_H_
|
||||
|
|
|
@ -110,9 +110,9 @@ void SimpleLogger::writeLog(FILE* file, int level, const char* msg, va_list ap,
|
|||
datestr[strlen(datestr)-1] = '\0';
|
||||
writeHeader(file, datestr, levelStr);
|
||||
vfprintf(file, string(Util::replace(msg, "\r", "")+"\n").c_str(), ap);
|
||||
if(e != NULL) {
|
||||
for(Exception* nestedEx = e; nestedEx; nestedEx = nestedEx->getCause()) {
|
||||
writeHeader(file, datestr, levelStr);
|
||||
fprintf(file, "exception: %s\n", Util::replace(e->getMsg(), "\r", "").c_str());
|
||||
fprintf(file, "exception: %s\n", Util::replace(nestedEx->getMsg(), "\r", "").c_str());
|
||||
}
|
||||
fflush(file);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue