-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGridayException.cpp
42 lines (32 loc) · 948 Bytes
/
GridayException.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "GridayException.hpp"
#include <sstream>
GridayException::GridayException(const std::string& file, int line,
const std::string& msg)
: mDepth {0}
{
std::stringstream ss;
ss << "File: " << file << ", Line: " << line << ", Message: " << msg;
mMsg = ss.str();
}
GridayException::GridayException(const std::string& file, int line,
const std::string& msg,
const GridayException& parent)
: mDepth {parent.getDepth() + 1}
{
std::stringstream ss;
ss << parent.what() << std::endl;
for (int i = 0; i < mDepth; ++i)
ss << " ";
ss << "File: " << file << ", Line: " << line << ", Message: " << msg;
mMsg = ss.str();
}
const char*
GridayException::what() const noexcept
{
return mMsg.c_str();
}
int
GridayException::getDepth() const
{
return mDepth;
}