#define _NB_AUTOLOG #include #include #include 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() { while(!nb::LOGGER_RUNNING) {} nb::logger.minimalLogLevel(0x0); nb::logger.msg("Whoop!"); try { THROW(TestError(0, TestError(1, TestError(2, TestError(3, TestError(2)))))); } catch (TestError e){ nb::logger.msg("nb::Error was thrown!"); } try { THROW(std::exception()); } catch (std::exception e){ nb::logger.msg("std::exception was thrown!"); } ERROR("hello there!"); return 0; }