diff options
author | Antonio MartÃn Berti <15972392+BertiRean@users.noreply.github.com> | 2024-05-29 14:03:37 -0300 |
---|---|---|
committer | Ovahlord <dreadkiller@gmx.de> | 2024-06-20 01:13:27 +0200 |
commit | 50eb64d331fbaec01c1ae5b8035901b4f1971b5c (patch) | |
tree | 2b288290ef13838c1a71980941a39c18b9e56076 /src | |
parent | 6b89285966d8d21a5f43dac702d50b917f71b19d (diff) |
Core/Misc: Remove separate storage for custom messages in exception types and store it directly in base class from <stdexcept> (#30012)
(cherry picked from commit 15e995b3b3cb7b96048b6b7830285c78bd901fb0)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/database/Updater/DBUpdater.h | 11 | ||||
-rw-r--r-- | src/server/game/AI/AIException.h | 11 |
2 files changed, 6 insertions, 16 deletions
diff --git a/src/server/database/Updater/DBUpdater.h b/src/server/database/Updater/DBUpdater.h index 691777e39e0..d3f240fe464 100644 --- a/src/server/database/Updater/DBUpdater.h +++ b/src/server/database/Updater/DBUpdater.h @@ -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 diff --git a/src/server/game/AI/AIException.h b/src/server/game/AI/AIException.h index 0f39bd78915..c2245174855 100644 --- a/src/server/game/AI/AIException.h +++ b/src/server/game/AI/AIException.h @@ -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 |