]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Texture.hh
better logging (maybe) and exception handling
[chaz/yoink] / src / Moof / Texture.hh
index cdb6059ceff00d039a41a8b68f6bae45a543f84c..d55f6f7309c71fe05765ac86c02abfbd53599959 100644 (file)
@@ -38,6 +38,7 @@
 
 #include <boost/shared_ptr.hpp>
 
+#include <Moof/Exception.hh>
 #include <Moof/OpenGL.hh>
 #include <Moof/Resource.hh>
 
@@ -65,10 +66,30 @@ public:
 
        static std::string getPath(const std::string& name);
 
-       struct Exception : std::runtime_error
+       struct Exception : public Mf::Exception
        {
-               explicit Exception(const std::string& what_arg) :
-                       std::runtime_error(what_arg) {}
+               enum
+               {
+                       BAD_IMAGE_FORMAT        = 1024
+               };
+
+               explicit Exception(unsigned error) :
+                       Mf::Exception(error) {}
+
+               void raise()
+               {
+                       throw *this;
+               }
+
+               const char* what() const throw()
+               {
+                       switch (code)
+                       {
+                               case BAD_IMAGE_FORMAT:
+                                       return "inappropriate image format";
+                       }
+                       return Mf::Exception::what();
+               }
        };
 
 private:
This page took 0.018739 seconds and 4 git commands to generate.