File indexing completed on 2026-09-15 09:32:04
0001 #ifndef UTIL_EXCEPTION_H
0002 #define UTIL_EXCEPTION_H
0003
0004 #include <exception>
0005 #include <string>
0006 #include <string_view>
0007
0008 namespace common_bench {
0009 class Exception : public std::exception {
0010 public:
0011 Exception(std::string_view msg, std::string_view type = "exception") : msg_{msg}, type_{type} {}
0012
0013 const char* what() const noexcept override { return msg_.c_str(); }
0014 const char* type() const noexcept { return type_.c_str(); }
0015 ~Exception() override = default;
0016
0017 private:
0018 std::string msg_;
0019 std::string type_;
0020 };
0021 }
0022
0023 #endif