Error library now logs all errors before throw
mainly done as I don't know how to fix throw for my os
This commit is contained in:
parent
8a1f700f84
commit
ca30e9b0a7
2 changed files with 15 additions and 5 deletions
|
|
@ -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; }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
class Error {
|
||||
|
|
|
|||
Loading…
Reference in a new issue