From b322b530bb19ccbd4dc0761d20d96a7ca4e5c976 Mon Sep 17 00:00:00 2001 From: "Timmer, Daan" Date: Thu, 11 Jan 2024 08:09:22 +0000 Subject: [PATCH] feat: Context::Get/GetShared now throws KeyNotFound instead of std::out_of_range --- cucumber-cpp/Context.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cucumber-cpp/Context.hpp b/cucumber-cpp/Context.hpp index f2c5095..64c9648 100644 --- a/cucumber-cpp/Context.hpp +++ b/cucumber-cpp/Context.hpp @@ -18,6 +18,11 @@ namespace cucumber_cpp { struct ContextStorage { + struct KeyNotFound : std::out_of_range + { + using std::out_of_range::out_of_range; + }; + struct Entry { Entry(std::string_view key, @@ -79,7 +84,7 @@ namespace cucumber_cpp else { std::cerr << "key not found: \"" << key << "\"" << std::endl; - throw std::out_of_range{ std::string{ key } }; + throw KeyNotFound{ std::string{ key } }; } }