]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- use exceptions instead of assert
authorArvin Schnell <aschnell@suse.de>
Wed, 20 Apr 2011 14:34:17 +0000 (16:34 +0200)
committerArvin Schnell <aschnell@suse.de>
Wed, 20 Apr 2011 14:34:17 +0000 (16:34 +0200)
snapper/Factory.cc

index 42e0c331483f91433681032ff6179fd3b8bece33..6947659a201999609f6038fc7005285ad7a45e84 100644 (file)
  */
 
 
-#include "assert.h"
 #include "auto_ptr.h"
 
 #include "snapper/Snapper.h"
+#include "snapper/Exception.h"
 
 
 namespace snapper
@@ -35,7 +35,9 @@ namespace snapper
     Snapper*
     createSnapper(const string& config_name)
     {
-       assert(!the_one.get());
+       if (the_one.get())
+           throw LogicErrorException();
+
        the_one.reset(new Snapper(config_name));
        return the_one.get();
     }
@@ -44,8 +46,9 @@ namespace snapper
     void
     deleteSnapper(Snapper* s)
     {
-       assert(the_one.get());
-       assert(s == the_one.get());
+       if (!the_one.get() || s != the_one.get())
+           throw LogicErrorException();
+
        the_one.reset();
     }