]> granicus.if.org Git - icinga2/commitdiff
Removed assert()s in ConfigItemBuilder::Compile.
authorGunnar Beutner <gunnar.beutner@netways.de>
Fri, 1 Feb 2013 13:45:55 +0000 (14:45 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Fri, 1 Feb 2013 13:45:55 +0000 (14:45 +0100)
lib/config/configitembuilder.cpp

index 70963bcec9e63f2f552c184786c5ddb870e8978b..ce27dc782aee838c4853b09a47b9fbb05ba30ae1 100644 (file)
@@ -82,8 +82,17 @@ void ConfigItemBuilder::AddExpressionList(const ExpressionList::Ptr& exprl)
 
 ConfigItem::Ptr ConfigItemBuilder::Compile(void)
 {
-       assert(!m_Type.IsEmpty());
-       assert(!m_Name.IsEmpty());
+       if (m_Type.IsEmpty()) {
+               stringstream msgbuf;
+               msgbuf << "The type name of an object may not be empty: " << m_DebugInfo;
+               throw_exception(invalid_argument(msgbuf.str()));
+       }
+
+       if (m_Name.IsEmpty()) {
+               stringstream msgbuf;
+               msgbuf << "The name of an object may not be empty: " << m_DebugInfo;
+               throw_exception(invalid_argument(msgbuf.str()));
+       }
 
        ExpressionList::Ptr exprl = boost::make_shared<ExpressionList>();