From 92662ff0389277a86ae86b2ff877c5a70c59169d Mon Sep 17 00:00:00 2001 From: knodlseder <> Date: Wed, 2 Feb 2011 09:59:37 +0000 Subject: [PATCH] add invalid_argument() exception --- include/GException.hpp | 7 +++++++ src/support/GException.cpp | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+), 0 deletions(-) diff --git a/include/GException.hpp b/include/GException.hpp index 325d904..1729a41 100644 --- a/include/GException.hpp +++ b/include/GException.hpp @@ -60,6 +60,13 @@ public: std::string message = ""); }; + // Invalid argument + class invalid_argument : public GExceptionHandler { + public: + invalid_argument(std::string origin, + std::string message = ""); + }; + // Bad type class bad_type : public GExceptionHandler { public: diff --git a/src/support/GException.cpp b/src/support/GException.cpp index 601a3cd..30a3e63 100644 --- a/src/support/GException.cpp +++ b/src/support/GException.cpp @@ -55,6 +55,28 @@ GException::feature_not_implemented::feature_not_implemented(std::string origin, /***********************************************************************//** + * @brief Invalid argument + * + * @param[in] origin Name of method that has thrown the exception. + * @param[in] message Optional message. + ***************************************************************************/ +GException::invalid_argument::invalid_argument(std::string origin, + std::string message) +{ + // Set origin + m_origin = origin; + + // Set message string + m_message = "Invalid argument encountered."; + if (message.length() > 0) + m_message += " " + message; + + // Return + return; +} + + +/***********************************************************************//** * @brief Bad type * * @param[in] origin Name of method that has thrown the exception. -- libgit2 0.21.4