mirror of https://github.com/aria2/aria2
2008-09-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Moved message of the error to OptionHandlerException.h * src/NameMatchOptionHandler.h * src/OptionHandlerException.hpull/1/head
parent
54bb630077
commit
e51e7207cf
|
@ -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>
|
2008-09-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
When error occurs while aria2 is parsing an command-line option, print
|
When error occurs while aria2 is parsing an command-line option, print
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
#define _D_NAME_MATCH_OPTION_HANDLER_H_
|
#define _D_NAME_MATCH_OPTION_HANDLER_H_
|
||||||
|
|
||||||
#include "OptionHandler.h"
|
#include "OptionHandler.h"
|
||||||
#include "StringFormat.h"
|
|
||||||
#include "A2STR.h"
|
#include "A2STR.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include "OptionHandlerException.h"
|
#include "OptionHandlerException.h"
|
||||||
|
@ -87,10 +86,7 @@ public:
|
||||||
try {
|
try {
|
||||||
parseArg(option, arg);
|
parseArg(option, arg);
|
||||||
} catch(Exception& e) {
|
} catch(Exception& e) {
|
||||||
throw OptionHandlerException
|
throw OptionHandlerException(_optName, e);
|
||||||
(StringFormat("Exception occurred while processing option %s:",
|
|
||||||
_optName.c_str()).str(),
|
|
||||||
_optName, e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,12 +35,16 @@
|
||||||
#ifndef _D_OPTION_HANDLER_EXCEPTION_H_
|
#ifndef _D_OPTION_HANDLER_EXCEPTION_H_
|
||||||
#define _D_OPTION_HANDLER_EXCEPTION_H_
|
#define _D_OPTION_HANDLER_EXCEPTION_H_
|
||||||
#include "FatalException.h"
|
#include "FatalException.h"
|
||||||
|
#include "StringFormat.h"
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
class OptionHandlerException:public FatalException {
|
class OptionHandlerException:public FatalException {
|
||||||
private:
|
private:
|
||||||
std::string _optName;
|
std::string _optName;
|
||||||
|
|
||||||
|
static const std::string MESSAGE =
|
||||||
|
"Exception occurred while processing option %s:";
|
||||||
protected:
|
protected:
|
||||||
virtual SharedHandle<Exception> copy() const
|
virtual SharedHandle<Exception> copy() const
|
||||||
{
|
{
|
||||||
|
@ -48,16 +52,17 @@ protected:
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
OptionHandlerException(const std::string& msg, const std::string& optName):
|
OptionHandlerException(const std::string& optName):
|
||||||
FatalException(msg), _optName(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):
|
const Exception& cause):
|
||||||
FatalException(msg, cause), _optName(optName) {}
|
FatalException
|
||||||
|
(StringFormat(MESSAGE, optName.c_str()).str(), cause), _optName(optName) {}
|
||||||
|
|
||||||
OptionHandlerException(const OptionHandlerException& e):
|
OptionHandlerException(const OptionHandlerException& e):
|
||||||
FatalException(e),
|
FatalException(e), _optName(e._optName) {}
|
||||||
_optName(e._optName) {}
|
|
||||||
|
|
||||||
virtual ~OptionHandlerException() throw() {}
|
virtual ~OptionHandlerException() throw() {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue