33 lines
967 B
C++
33 lines
967 B
C++
|
#include "sdlerror.hpp"
|
||
|
#include <iostream>
|
||
|
#include <sstream>
|
||
|
#include <ciso646>
|
||
|
#include <SDL2/SDL.h>
|
||
|
|
||
|
namespace cloonel {
|
||
|
namespace {
|
||
|
} //unnamed namespace
|
||
|
|
||
|
///------------------------------------------------------------------------
|
||
|
///------------------------------------------------------------------------
|
||
|
std::string GetFullErrorMessage (const char* parFunction, const std::string& parMessage) {
|
||
|
std::ostringstream oss;
|
||
|
if (parFunction)
|
||
|
oss << "Error in " << parFunction << ": ";
|
||
|
else
|
||
|
oss << "Error: ";
|
||
|
|
||
|
if (not parMessage.empty())
|
||
|
oss << parMessage << " - ";
|
||
|
|
||
|
oss << SDL_GetError();
|
||
|
return oss.str();
|
||
|
}
|
||
|
|
||
|
///------------------------------------------------------------------------
|
||
|
///------------------------------------------------------------------------
|
||
|
void ShowError (const char* parFunction, const std::string& parMessage) {
|
||
|
std::cerr << GetFullErrorMessage(parFunction, parMessage) << std::endl;
|
||
|
}
|
||
|
} //namespace cloonel
|