diff --git a/libwccl/exception.cpp b/libwccl/exception.cpp index 46c5cc1b7cdbe7e3b097cfc7fb364ce58d9c6756..e1c6a297cdc515613da5e8e15f239745f0e45d64 100644 --- a/libwccl/exception.cpp +++ b/libwccl/exception.cpp @@ -40,4 +40,22 @@ std::string FileNotFound::info() const return ss.str(); } +InvalidArgument::InvalidArgument(const std::string &arg_name, const std::string &reason) + : WcclError(reason), + arg_name(arg_name), + reason(reason) +{ +} + +InvalidArgument::~InvalidArgument() throw() +{ +} + +std::string InvalidArgument::info() const +{ + std::ostringstream ss; + ss << "Invalid argument " << arg_name << " : " << reason; + return ss.str(); +} + } /* end ns Wccl */ diff --git a/libwccl/exception.h b/libwccl/exception.h index 2d52855993d57fc2233966899beac2a3cfae6a79..74b9576cb0427c4ecc8babc6eb8fe6ef2d65471b 100644 --- a/libwccl/exception.h +++ b/libwccl/exception.h @@ -38,6 +38,19 @@ public: std::string filename, paths, where; }; +class InvalidArgument : public WcclError +{ +public: + InvalidArgument(const std::string& arg_name, const std::string& reason); + + ~InvalidArgument() throw(); + + std::string info() const; + + std::string arg_name; + std::string reason; +}; + } /* end ns Wccl */ #endif // LIBWCCL_EXCEPTION_H