From a6435107c96f523c2fdc1e845522091d3ae42793 Mon Sep 17 00:00:00 2001 From: Adam Wardynski <award@.(B-4.4.46a)> Date: Fri, 3 Dec 2010 14:58:59 +0100 Subject: [PATCH] InvalidArgument exception. --- libwccl/exception.cpp | 18 ++++++++++++++++++ libwccl/exception.h | 13 +++++++++++++ 2 files changed, 31 insertions(+) diff --git a/libwccl/exception.cpp b/libwccl/exception.cpp index 46c5cc1..e1c6a29 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 2d52855..74b9576 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 -- GitLab