diff --git a/src/Battling/Flow/ResolveTarget.hpp b/src/Battling/Flow/ResolveTarget.hpp index 4667151..e8c3d29 100644 --- a/src/Battling/Flow/ResolveTarget.hpp +++ b/src/Battling/Flow/ResolveTarget.hpp @@ -105,6 +105,8 @@ namespace CreatureLib::Battling { return {battle->GetCreature(index)}; }; } + THROW_CREATURE("Unknown attack target kind: '" << CreatureLib::Library::AttackTargetHelper::ToString(target) + << "'."); } }; } diff --git a/src/Library/Exceptions/CreatureException.hpp b/src/Library/Exceptions/CreatureException.hpp index 8fc500a..c832554 100644 --- a/src/Library/Exceptions/CreatureException.hpp +++ b/src/Library/Exceptions/CreatureException.hpp @@ -10,4 +10,8 @@ public: virtual ~CreatureException() = default; }; +#define THROW_CREATURE(message) \ + std::stringstream ss; \ + ss << message; \ + throw CreatureException(ss.str()); #endif // CREATURELIB_CREATUREEXCEPTION_HPP