]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/objectloader.h
Exception rework for loader components
[libs/datafile.git] / source / objectloader.h
index bab1ce5378f5bce344fd931d80061b6a67af9698..f1cb6ffe051c5f8405fa652a67d36b3001dee380 100644 (file)
@@ -1,11 +1,18 @@
 #ifndef MSP_DATAFILE_OBJECTLOADER_H_
 #define MSP_DATAFILE_OBJECTLOADER_H_
 
+#include <typeinfo>
 #include "loader.h"
 
 namespace Msp {
 namespace DataFile {
 
+class no_collection: public std::runtime_error
+{
+public:
+       no_collection(const std::type_info &);
+};
+
 class Collection;
 
 /**
@@ -47,7 +54,7 @@ public:
        C &get_collection() const
        {
                if(!coll)
-                       throw InvalidState("No collection");
+                       throw no_collection(typeid(O));
                return *coll;
        }
 };