From 4bf7fbd52c1226aca81a89ad5a6eecec1306da74 Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Sat, 27 Dec 2014 02:07:07 +0300 Subject: [PATCH] Store SDL error inside Exception Fixes #22 --- SDL2pp/Exception.cc | 2 +- SDL2pp/Exception.hh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/SDL2pp/Exception.cc b/SDL2pp/Exception.cc index 546ade5..463415c 100644 --- a/SDL2pp/Exception.cc +++ b/SDL2pp/Exception.cc @@ -36,7 +36,7 @@ const char* Exception::what() const noexcept { } const char* Exception::GetSDLError() const noexcept { - return sdl_error_; + return sdl_error_.c_str(); } } // namespace SDL2pp diff --git a/SDL2pp/Exception.hh b/SDL2pp/Exception.hh index 4e6b8e4..c6fb5cf 100644 --- a/SDL2pp/Exception.hh +++ b/SDL2pp/Exception.hh @@ -22,6 +22,7 @@ #ifndef SDL2PP_EXCEPTION_HH #define SDL2PP_EXCEPTION_HH +#include #include namespace SDL2pp { @@ -29,7 +30,7 @@ namespace SDL2pp { class Exception : public std::exception { private: const char* what_; - const char* sdl_error_; + std::string sdl_error_; public: Exception(const char* what = "");