Store SDL error inside Exception

Fixes #22
This commit is contained in:
Dmitry Marakasov 2014-12-27 02:07:07 +03:00
parent f5216c309f
commit 4bf7fbd52c
2 changed files with 3 additions and 2 deletions

View File

@ -36,7 +36,7 @@ const char* Exception::what() const noexcept {
} }
const char* Exception::GetSDLError() const noexcept { const char* Exception::GetSDLError() const noexcept {
return sdl_error_; return sdl_error_.c_str();
} }
} // namespace SDL2pp } // namespace SDL2pp

View File

@ -22,6 +22,7 @@
#ifndef SDL2PP_EXCEPTION_HH #ifndef SDL2PP_EXCEPTION_HH
#define SDL2PP_EXCEPTION_HH #define SDL2PP_EXCEPTION_HH
#include <string>
#include <exception> #include <exception>
namespace SDL2pp { namespace SDL2pp {
@ -29,7 +30,7 @@ namespace SDL2pp {
class Exception : public std::exception { class Exception : public std::exception {
private: private:
const char* what_; const char* what_;
const char* sdl_error_; std::string sdl_error_;
public: public:
Exception(const char* what = ""); Exception(const char* what = "");