diff --git a/src/Error.cpp b/src/Error.cpp index ddfc31c..f01df3e 100644 --- a/src/Error.cpp +++ b/src/Error.cpp @@ -1,9 +1,18 @@ #include "Error.h" Error::Error(std::string location) { object = location; } -void Error::crash(std::string msg) { throw object + ": " + msg; } -void Error::crash(std::string reason, std::string msg) { - throw object + ": " + reason + ": " + msg; +void Error::crash(std::string msg) { + log("Error: " + msg); + throw object + ": \n" + msg; +} +void Error::crash(std::string reason, std::string msg) { + log("Error: " + reason + ": \n" + msg); + throw object + ": \n" + reason + ": \n" + msg; +} +void Error::warn(std::string msg) { + log("Warining: " + msg); + // throw object + ": " + msg; +} +void Error::log(std::string msg) { + std::cout << object << ": \n" << msg << std::endl; } -void Error::warn(std::string msg) { throw object + ": " + msg; } -void Error::log(std::string msg) { throw object + ": " + msg; } diff --git a/src/Error.h b/src/Error.h index 0d827c8..d5ec9d0 100644 --- a/src/Error.h +++ b/src/Error.h @@ -1,4 +1,5 @@ #pragma once +#include #include class Error {