1 /* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */ 2 3 #ifndef EXCEPTIONS_H 4 #define EXCEPTIONS_H 5 6 #include <stdexcept> 7 8 9 /** 10 * user_error 11 * thrown when a enduser config is broken/invalid. 12 */ 13 class user_error : public std::runtime_error 14 { 15 public: user_error(const std::string & msg)16 user_error(const std::string& msg) : std::runtime_error(msg) {}; 17 }; 18 19 20 /** 21 * content_error 22 * thrown when content couldn't be found/loaded. 23 * any other type of exception will cause a crashreport box appearing 24 * (if it is installed). 25 */ 26 class content_error : public std::runtime_error 27 { 28 public: content_error(const std::string & msg)29 content_error(const std::string& msg) : std::runtime_error(msg) {}; 30 }; 31 32 33 /** 34 * opengl_error 35 * thrown when an OpenGL function failed (FBO creation, Offscreen Context creation, ...). 36 */ 37 class opengl_error : public std::runtime_error 38 { 39 public: opengl_error(const std::string & msg)40 opengl_error(const std::string& msg) : std::runtime_error(msg) {}; 41 }; 42 43 44 /** 45 * unsupported_error 46 * thrown when code cannot be executed cause the system is unsupported (GPU is missing extensions etc.) 47 */ 48 class unsupported_error : public std::runtime_error 49 { 50 public: unsupported_error(const std::string & msg)51 unsupported_error(const std::string& msg) : std::runtime_error(msg) {}; 52 }; 53 54 55 /** 56 * network_error 57 * thrown when udp socket can't be bound or hostname can't be resolved 58 */ 59 class network_error : public std::runtime_error 60 { 61 public: network_error(const std::string & msg)62 network_error(const std::string& msg) : std::runtime_error(msg) {}; 63 }; 64 65 66 #endif 67