Made Exception more verbose
This commit is contained in:
parent
1450875965
commit
5709c595c3
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
#pragma once
|
||||
#include <exception>
|
||||
#include <string>
|
||||
|
||||
namespace sdlu
|
||||
{
|
||||
|
@ -13,7 +14,7 @@ namespace sdlu
|
|||
virtual public std::exception
|
||||
{
|
||||
public:
|
||||
ObjectCreationException(const char* description) :
|
||||
ObjectCreationException(std::string description) :
|
||||
m_pDescription(description)
|
||||
{
|
||||
// Empty
|
||||
|
@ -21,10 +22,10 @@ namespace sdlu
|
|||
|
||||
virtual const char* what() const throw()
|
||||
{
|
||||
return m_pDescription;
|
||||
return m_pDescription.c_str();
|
||||
}
|
||||
|
||||
private:
|
||||
const char* m_pDescription;
|
||||
std::string m_pDescription;
|
||||
};
|
||||
}
|
|
@ -36,12 +36,13 @@ namespace sdlu
|
|||
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||
dimension.x, dimension.y,
|
||||
windowFlags);
|
||||
|
||||
THROW_IF(IS_NULLPTR(m_pWindow),
|
||||
ObjectCreationException("Failed to create SDL_Window."));
|
||||
ObjectCreationException("Failed to create SDL_Window. \nSDL_GetError(): " + std::string(SDL_GetError())));
|
||||
|
||||
m_pRenderer = SDL_CreateRenderer(m_pWindow, -1, rendererFlags);
|
||||
THROW_IF(IS_NULLPTR(m_pRenderer),
|
||||
ObjectCreationException("Failed to create SDL_Renderer."));
|
||||
ObjectCreationException("Failed to create SDL_Renderer. \nSDL_GetError(): " + std::string(SDL_GetError())));
|
||||
|
||||
OnCreate();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue