#include #include "Errors.hpp" #include "Logger.hpp" class TestError : public nb::Error { using Base = Error; public: using Base::Base; using Base::what; using Base::code; using Base::msg; using Base::trace; enum Codes : unsigned int { A, B, C, D }; static const std::string type; static const nb::ErrorCodeMap ErrorMessages; }; const std::string TestError::type="TestError"; const nb::ErrorCodeMap TestError::ErrorMessages{ {TestError::Codes::A, "Hey!"}, {TestError::Codes::B, "How"}, {TestError::Codes::C, "You"}, {TestError::Codes::D, "Doin"} }; int main() { nb::logger.log("Whoop!"); try { THROW(nb::Error(1)); } catch (nb::Error<> e){ nb::logger.log("nb::Error was thrown!"); } try { THROW(std::exception()); } catch (std::exception e){ nb::logger.log("std::exception was thrown!"); } return 0; }