Core/Misc: Remove separate storage for custom messages in exception types and store it directly in base class from <stdexcept> (#30012)

This commit is contained in:
Antonio Martín Berti
2024-05-29 14:03:37 -03:00
committed by GitHub
parent 937e618533
commit 15e995b3b3
2 changed files with 6 additions and 16 deletions

View File

@@ -20,6 +20,7 @@
#include "Define.h"
#include "DatabaseEnvFwd.h"
#include <stdexcept>
#include <string>
template <class T>
@@ -33,16 +34,10 @@ namespace boost
}
}
class TC_DATABASE_API UpdateException : public std::exception
class TC_DATABASE_API UpdateException : public std::runtime_error
{
public:
UpdateException(std::string const& msg) : _msg(msg) { }
~UpdateException() throw() { }
char const* what() const throw() override { return _msg.c_str(); }
private:
std::string const _msg;
using std::runtime_error::runtime_error;
};
enum BaseLocation

View File

@@ -19,17 +19,12 @@
#define TRINITY_AIEXCEPTION_H
#include "Define.h"
#include <exception>
#include <string>
#include <stdexcept>
class TC_GAME_API InvalidAIException : public std::exception
class TC_GAME_API InvalidAIException : public std::logic_error
{
public:
InvalidAIException(char const* msg) : msg_(msg) {}
char const* what() const noexcept override { return msg_.c_str(); }
private:
std::string const msg_;
using std::logic_error::logic_error;
};
#endif