diff --git a/CInterface/Core.hpp b/CInterface/Core.hpp index e6ddf34..1eaaa24 100644 --- a/CInterface/Core.hpp +++ b/CInterface/Core.hpp @@ -14,9 +14,9 @@ class ExceptionHandler { static std::string _lastException; public: - static void SetLastException(std::string file, std::string function, int line, const std::exception& e) { + static void SetLastException(std::string function, const std::exception& e) { std::stringstream ss; - ss << "[" << file << ", " << function << "-" << line << "] " << e.what(); + ss << "[" << function << "] " << e.what(); _lastException = ss.str(); } static const char* GetLastException() { return _lastException.c_str(); } @@ -27,7 +27,7 @@ public: data; \ return 0; \ } catch (const std::exception& e) { \ - ExceptionHandler::SetLastException(__FILENAME__, __FUNCTION__, __LINE__, e); \ + ExceptionHandler::SetLastException(__FUNCTION__, e); \ return CreatureLibException; \ } diff --git a/src/Library/Exceptions/CreatureException.hpp b/src/Library/Exceptions/CreatureException.hpp index c832554..7526a48 100644 --- a/src/Library/Exceptions/CreatureException.hpp +++ b/src/Library/Exceptions/CreatureException.hpp @@ -3,6 +3,7 @@ #include #include +#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) class CreatureException : public std::runtime_error { public: @@ -12,6 +13,6 @@ public: #define THROW_CREATURE(message) \ std::stringstream ss; \ - ss << message; \ + ss << "[" << __FILENAME__ << ", " << __LINE__ << "] " << message; \ throw CreatureException(ss.str()); #endif // CREATURELIB_CREATUREEXCEPTION_HPP