--- /dev/null
+#include "error.hpp"
+
+#include <alut.h>
+#include <SDL.h>
+#include <GL/glew.h>
+
+using std::runtime_error;
+using std::string;
+
+
+namespace {
+
+const char *sdl_error_flush() {
+ const char *err = SDL_GetError();
+ if (err && *err) {
+ SDL_ClearError();
+ }
+ return err;
+}
+
+string error_append(string msg, const char *err) {
+ if (err && *err) {
+ msg += ": ";
+ msg += err;
+ }
+ return msg;
+}
+
+}
+
+namespace tacos {
+
+AlutError::AlutError(const char *msg)
+: runtime_error(error_append(msg, alutGetErrorString(alutGetError()))) {
+
+}
+
+
+GLError::GLError(const char *msg)
+: runtime_error(error_append(msg, reinterpret_cast<const char *>(gluErrorString(glGetError())))) {
+
+}
+
+
+GLCompileError::GLCompileError(const char *msg, const char *log)
+: runtime_error(error_append(msg, reinterpret_cast<const char *>(gluErrorString(glGetError()))) + '\n' + log) {
+
+}
+
+
+SDLError::SDLError(const char *msg)
+: runtime_error(error_append(msg, sdl_error_flush())) {
+
+}
+
+}