2008-09-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Moved message of the error to OptionHandlerException.h
	* src/NameMatchOptionHandler.h
	* src/OptionHandlerException.h
pull/1/head
Tatsuhiro Tsujikawa 2008-09-27 04:35:36 +00:00
parent 54bb630077
commit e51e7207cf
3 changed files with 19 additions and 12 deletions

View File

@ -1,3 +1,9 @@
2008-09-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Moved message of the error to OptionHandlerException.h
* src/NameMatchOptionHandler.h
* src/OptionHandlerException.h
2008-09-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
When error occurs while aria2 is parsing an command-line option, print

View File

@ -36,7 +36,6 @@
#define _D_NAME_MATCH_OPTION_HANDLER_H_
#include "OptionHandler.h"
#include "StringFormat.h"
#include "A2STR.h"
#include "Util.h"
#include "OptionHandlerException.h"
@ -87,11 +86,8 @@ public:
try {
parseArg(option, arg);
} catch(Exception& e) {
throw OptionHandlerException
(StringFormat("Exception occurred while processing option %s:",
_optName.c_str()).str(),
_optName, e);
}
throw OptionHandlerException(_optName, e);
}
}
virtual bool hasTag(const std::string& tag) const

View File

@ -35,12 +35,16 @@
#ifndef _D_OPTION_HANDLER_EXCEPTION_H_
#define _D_OPTION_HANDLER_EXCEPTION_H_
#include "FatalException.h"
#include "StringFormat.h"
namespace aria2 {
class OptionHandlerException:public FatalException {
private:
std::string _optName;
static const std::string MESSAGE =
"Exception occurred while processing option %s:";
protected:
virtual SharedHandle<Exception> copy() const
{
@ -48,16 +52,17 @@ protected:
return e;
}
public:
OptionHandlerException(const std::string& msg, const std::string& optName):
FatalException(msg), _optName(optName) {}
OptionHandlerException(const std::string& optName):
FatalException
(StringFormat(MESSAGE, optName.c_str()).str()), _optName(optName) {}
OptionHandlerException(const std::string& msg, const std::string& optName,
OptionHandlerException(const std::string& optName,
const Exception& cause):
FatalException(msg, cause), _optName(optName) {}
FatalException
(StringFormat(MESSAGE, optName.c_str()).str(), cause), _optName(optName) {}
OptionHandlerException(const OptionHandlerException& e):
FatalException(e),
_optName(e._optName) {}
FatalException(e), _optName(e._optName) {}
virtual ~OptionHandlerException() throw() {}