16 const char *al_error_string(ALenum num) {
21 return "invalid name";
23 return "invalid enum";
24 case AL_INVALID_VALUE:
25 return "invalid value";
26 case AL_INVALID_OPERATION:
27 return "invalid operation";
28 case AL_OUT_OF_MEMORY:
29 return "out of memory";
31 return "unknown AL error";
34 std::string al_error_append(ALenum num, std::string msg) {
35 return msg + ": " + al_error_string(num);
38 string alut_error_append(ALenum num, string msg) {
39 const char *error = alutGetErrorString(num);
40 if (error && *error != '\0') {
47 string gl_error_append(string msg) {
48 const GLubyte *error = gluErrorString(glGetError());
49 if (error && *error != '\0') {
50 const GLubyte *errEnd = error;
51 while (*errEnd != '\0') {
55 msg.append(error, errEnd);
60 string gl_error_get() {
62 const GLubyte *error = gluErrorString(glGetError());
63 if (error && *error != '\0') {
64 const GLubyte *errEnd = error;
65 while (*errEnd != '\0') {
68 msg.assign(error, errEnd);
73 string net_error_append(string msg) {
74 const char *error = SDLNet_GetError();
82 string sdl_error_append(string msg) {
83 const char *error = SDL_GetError();
84 if (error && *error != '\0') {
92 string ttf_error_append(string msg) {
93 const char *error = TTF_GetError();
94 if (error && *error != '\0') {
107 ALError::ALError(ALenum num)
108 : std::runtime_error(al_error_string(num)) {
112 ALError::ALError(ALenum num, const std::string &msg)
113 : std::runtime_error(al_error_append(num, msg)) {
118 AlutError::AlutError(ALenum num)
119 : runtime_error(alutGetErrorString(num)) {
123 AlutError::AlutError(ALenum num, const string &msg)
124 : runtime_error(alut_error_append(num, msg)) {
130 : runtime_error(gl_error_get()) {
134 GLError::GLError(const string &msg)
135 : runtime_error(gl_error_append(msg)) {
141 : runtime_error(SDLNet_GetError()) {
145 NetError::NetError(const string &msg)
146 : runtime_error(net_error_append(msg)) {
152 : runtime_error(SDL_GetError()) {
156 SDLError::SDLError(const string &msg)
157 : runtime_error(sdl_error_append(msg)) {
167 SysError::SysError(const string &msg)
168 : SysError(errno, msg) {
172 SysError::SysError(int err_num)
173 : runtime_error(strerror(err_num)) {
177 SysError::SysError(int err_num, const string &msg)
178 : runtime_error(msg + ": " + strerror(err_num)) {
184 : runtime_error(TTF_GetError()) {
188 TTFError::TTFError(const string &msg)
189 : runtime_error(ttf_error_append(msg)) {