Checked for more usual realife error cascade situation

This commit is contained in:
NaifBanana
2025-11-09 23:55:19 -06:00
parent c2cdfe7052
commit 3ac76f1fac
2 changed files with 37 additions and 10 deletions
+10 -2
View File
@@ -8,6 +8,14 @@
#include <type_traits>
#include <unordered_map>
#ifndef THROW
#ifdef CODE_ERROR_LOCATIONS
#define THROW(type, ...) throw type(__VA_ARGS__, __LINE__, __FILE__)
#else
#define THROW(type, ...) throw type(__VA_ARGS__)
#endif
#endif
namespace nb {
typedef std::unordered_map<unsigned int, const char*> ErrorCodeMap;
@@ -98,8 +106,8 @@ public:
};
Error(unsigned int code) : ErrorBase<Error>(code, ErrorBase<Error>::lookup(code)) {}
Error(unsigned int code, const std::exception& trace)
: ErrorBase<Error>(code, ErrorBase<Error>::lookup(code), trace) {}
Error(unsigned int code, const std::exception& trace, unsigned int line=0, const std::string& filename="")
: ErrorBase<Error>(code, ErrorBase<Error>::lookup(code), trace, line, filename) {}
friend ErrorBase<Error>;