diff --git a/tinio/main.cpp b/tinio/main.cpp index 427d9a9..f321498 100644 --- a/tinio/main.cpp +++ b/tinio/main.cpp @@ -4,20 +4,53 @@ #include using namespace std; + namespace errorEngine { + enum errorLevel_t {debug = 0,warning,error,crash}; + errorLevel_t globalErrLvl = error; struct errorEngineCreds { string errorLocation; string errorName; int8_t errorValue; errorLevel_t errorLevel; + bool isCyErrVal; }; - void handleErrors(errorEngineCreds); + void handleErrors(errorEngineCreds eecToEval) + { + switch(eecToEval.errorLevel) + { + case debug: + if (globalErrLvl == debug) + { + cerr << "Debug: " << eecToEval.errorLocation << ": " << eecToEval.errorName << endl; + } + + case warning: + if (globalErrLvl == warning) + { + cerr << "Warning: " << eecToEval.errorLocation << ": " << eecToEval.errorName << endl; + } + case error: + if (globalErrLvl == error) + { + cerr << "ERROR: " << eecToEval.errorLocation << ": " << eecToEval.errorName << endl; + } + case crash: + if (globalErrLvl == crash) + { + cerr << "FATAL ERROR: " << eecToEval.errorLocation << ": " << eecToEval.errorName << endl; + cerr << "REQUESTING CRASH!" <