File indexing completed on 2025-01-31 09:34:29
0001
0002
0003
0004
0005
0006 #pragma once
0007
0008 #include <exception>
0009 #include <string>
0010
0011 namespace algorithms {
0012
0013 class Error : public std::exception {
0014 public:
0015 Error(std::string_view msg, std::string_view type = "algorithms::Error")
0016 : m_msg{msg}, m_type{type} {}
0017
0018 virtual const char* what() const noexcept { return m_msg.c_str(); }
0019 virtual const char* type() const noexcept { return m_type.c_str(); }
0020 virtual ~Error() noexcept {}
0021
0022 private:
0023 const std::string m_msg;
0024 const std::string m_type;
0025 };
0026
0027 }
0028