57 : message_(std::move(text))
62 int nptrs = backtrace(buffer, stack);
66 strings = backtrace_symbols(buffer, nptrs);
68 for (
int j = 2; j < nptrs - 2; j++)
72 std::string beginName =
"";
78 for (
char* p = strings[j]; *p; ++p)
82 if ((*p ==
'(') && !dep)
93 char* ret = abi::__cxa_demangle(beginName.c_str(),
98 for (
char* p = ret; *p; ++p)
134 :
Exception(text +
" (" + std::to_string(badInt) +
")")
140 :
Exception(text +
" (" + std::to_string(badNumber) +
")")
141 , badNumber_(badNumber)
146 :
Exception(text +
" (" + badNumber +
")")
147 , badNumber_(badNumber)
152 std::size_t upperBound)
153 :
Exception(std::to_string(badInt) +
" out of [" + std::to_string(lowerBound) +
", " + std::to_string(upperBound) +
"] " + std::move(text))
155 , bounds_{{lowerBound, upperBound}}
158 const std::array<std::size_t, 2>& IndexOutOfBoundsException::getBounds()
const {
return bounds_; }
159 std::size_t IndexOutOfBoundsException::getBadIndex()
const {
return badIndex_; }
161 BadSizeException::BadSizeException(std::string text, std::size_t badSize, std::size_t correctSize)
162 :
Exception(
"Incorrect size " + std::to_string(badSize) +
", expected " + std::to_string(correctSize) +
". " + text)
164 , correctSize_(correctSize)
170 :
Exception(std::to_string(badValue) +
" out of [" + std::to_string(lowerBound) +
", " +
171 std::to_string(upperBound) +
"]" + std::move(text))
172 , badValue_(badValue)
173 , bounds_{{lowerBound, upperBound}}
int getBadInteger() const
Get the integer that threw this exception.
BadIntegerException(std::string text, int badInt)
Build a new BadIntegerException.
BadNumberException(std::string text, double badNumber)
Build a new BadNumberException.
double getBadNumber() const
Get the number that threw this exception.
std::size_t getCorrectSize() const
std::size_t getBadSize() const
Exception base class. Overload exception constructor (to control the exceptions mechanism)....
const char * what() const noexcept override
Method to get the message of the exception (STL method redefinition).
const std::string & message() const noexcept
Access the message as a std::string.
Exception(std::string text, int stack=10)
Build a new Exception.
IOException(std::string text)
Build a new IOException.
IndexOutOfBoundsException(std::string text, std::size_t badInt, std::size_t lowerBound, std::size_t upperBound)
Build a new IndexOutOfBoundsException.
NotImplementedException(std::string text)
Build a new NotImplementedException.
NullPointerException(std::string text)
Build a new NullPointerException.
OutOfRangeException(std::string text, double badValue, double lowerBound, double upperBound)
Build a new OutOfRangeException.
double getUpperBound() const
double getBadValue() const
std::array< double, 2 > bounds_
double getLowerBound() const
ZeroDivisionException(std::string text)
Build a new ZeroDivisionException.