#include "Errors.hpp" #include using namespace nb; class TestError : public nb::Error { public: TestError(unsigned int code, nb::Error* const trace=nullptr) : _type("nb::TestError"), Error(code, ErrorCodeLookup(code), trace) {} friend const char* ErrorCodeLookup(unsigned int); protected: static const nb::ErrorCodeMap ErrorCodes; const char* _type; }; const ErrorCodeMap TestError::ErrorCodes{ {0, "Hey!"}, {1, "How"}, {2, "You"}, {3, "Doin"} }; int main() { TestError a(0); TestError b(1, &a); TestError c(2, &b); throw TestError(3, &c); return 0; }