From 9de64375e03b24ea46d36cec222150754e3818cb Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 5 Dec 2007 15:21:01 +0000 Subject: [PATCH] Store the failed key in KeyError --- source/core/except.cpp | 5 +++++ source/core/except.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/source/core/except.cpp b/source/core/except.cpp index 245bc05..4b6e465 100644 --- a/source/core/except.cpp +++ b/source/core/except.cpp @@ -24,6 +24,11 @@ SystemError::SystemError(const string &w_, int e): err(e) { } +KeyError::KeyError(const string &w_, const string &k): + Exception(w_+" ("+k+")"), + key(k) +{ } + string SystemError::build_what(const string &w, int e) { ostringstream buf; diff --git a/source/core/except.h b/source/core/except.h index d030c41..a18e028 100644 --- a/source/core/except.h +++ b/source/core/except.h @@ -46,6 +46,10 @@ class KeyError: public Exception { public: KeyError(const std::string &w_): Exception(w_) { } + KeyError(const std::string &w_, const std::string &k) { } + const std::string &get_key() const { return key; } +private: + std::string key; }; /** -- 2.43.0