diff --git a/libs/util/include/psemek/util/key_error.hpp b/libs/util/include/psemek/util/key_error.hpp new file mode 100644 index 00000000..ee8dbd2d --- /dev/null +++ b/libs/util/include/psemek/util/key_error.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include +#include + +#include + +namespace psemek::util +{ + + template + struct key_error + : std::out_of_range + { + key_error(Key const & key) + : std::out_of_range(to_string("unknown key ", key, " of type ", type_name())) + , key_(key) + {} + + Key const & key() const noexcept + { + return key_; + } + + private: + Key key_; + }; + +}