2021-04-04 21:04:12 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <stdexcept>
|
2021-04-06 02:10:14 +01:00
|
|
|
|
2021-04-04 21:04:12 +01:00
|
|
|
namespace Bloom::Exceptions
|
|
|
|
|
{
|
|
|
|
|
class Exception: public std::runtime_error
|
|
|
|
|
{
|
|
|
|
|
public:
|
2021-04-06 02:10:14 +01:00
|
|
|
explicit Exception(): std::runtime_error("") {}
|
2022-03-02 00:56:40 +00:00
|
|
|
virtual ~Exception() = default;
|
|
|
|
|
|
|
|
|
|
Exception(const Exception& other) noexcept = default;
|
|
|
|
|
Exception(Exception&& other) = default;
|
|
|
|
|
|
|
|
|
|
Exception& operator = (const Exception& other) = default;
|
|
|
|
|
Exception& operator = (Exception&& other) = default;
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2021-12-22 23:11:18 +00:00
|
|
|
explicit Exception(const std::string& message): std::runtime_error(message.c_str()), message(message) {}
|
2021-04-04 21:04:12 +01:00
|
|
|
|
2021-12-22 23:11:18 +00:00
|
|
|
explicit Exception(const char* message): std::runtime_error(message), message(std::string(message)) {}
|
2021-04-04 21:04:12 +01:00
|
|
|
|
|
|
|
|
const char* what() const noexcept override {
|
|
|
|
|
return this->message.c_str();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string getMessage() const {
|
|
|
|
|
return this->message;
|
|
|
|
|
}
|
2021-10-06 21:12:31 +01:00
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
std::string message;
|
2021-04-04 21:04:12 +01:00
|
|
|
};
|
2021-06-22 23:52:31 +01:00
|
|
|
}
|