Throw all exceptions with Arbutils exception.

This commit is contained in:
2020-08-15 14:50:17 +02:00
parent 3e96d2fd76
commit f158dbf8a2
6 changed files with 21 additions and 13 deletions

View File

@@ -23,7 +23,7 @@ namespace ArbUt {
[[maybe_unused]] const auto& v = _map.insert({key, value});
#ifndef NO_ASSERT
if (!v.second)
throw std::logic_error("Key already exists");
throw ArbUt::Exception("Key already exists");
#endif
}

View File

@@ -4,6 +4,7 @@
#include <sstream>
#include <stdexcept>
#include <vector>
#include "../Exception.hpp"
namespace ArbUt {
template <class ValueT> class List {
@@ -27,7 +28,7 @@ namespace ArbUt {
if (index >= _vector.size() || index < 0) {
std::stringstream ss;
ss << "Index " << index << " is out of bounds.";
throw std::logic_error(ss.str());
throw ArbUt::Exception(ss.str());
}
#endif
return _vector.at(index);
@@ -38,7 +39,7 @@ namespace ArbUt {
if (index >= _vector.size() || index < 0) {
std::stringstream ss;
ss << "Index " << index << " is out of bounds.";
throw std::logic_error(ss.str());
throw ArbUt::Exception(ss.str());
}
#endif
return _vector.at(index);
@@ -49,7 +50,7 @@ namespace ArbUt {
if (index >= _vector.size() || index < 0) {
std::stringstream ss;
ss << "Index " << index << " is out of bounds.";
throw std::logic_error(ss.str());
throw ArbUt::Exception(ss.str());
}
#endif
const auto& prev = _vector.at(index);