1#include "../include/core/error.h"
16Exception::Exception(
int _code,
const String& _err,
const String& _func,
const String& _file,
int _line)
17 : code(_code), err(_err), func(_func), file(_file), line(_line)
22Exception::~Exception() throw() {}
27const char* Exception::what()
const throw()
32void Exception::formatMessage()
34 size_t pos = err.find(
'\n');
35 bool multiline = pos != String::npos;
39 while (pos != String::npos)
41 std::cout <<
"> " << err.substr(prev_pos, pos - prev_pos) << std::endl;
43 pos = err.find(
'\n', prev_pos);
45 std::cout <<
"> " << err.substr(prev_pos);
46 if (err[err.size() - 1] !=
'\n')
47 std::cout << std::endl;
54CError* CError::instance(std::string filename)
56 static CError* obj =
nullptr;
58 obj =
new CError(filename);
63CError::CError(std::string& filename)
65 m_filename = filename;