[icinga-checkins] icinga.org: icinga2/master: Removed assert()s in ConfigItemBuilder::Compile .

git at icinga.org git at icinga.org
Fri Feb 1 14:49:06 CET 2013


Module: icinga2
Branch: master
Commit: 6c0a6a22074c3472bb71889e3631706a54e5c21a
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=6c0a6a22074c3472bb71889e3631706a54e5c21a

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Fri Feb  1 14:45:55 2013 +0100

Removed assert()s in ConfigItemBuilder::Compile.

---

 lib/config/configitembuilder.cpp |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/lib/config/configitembuilder.cpp b/lib/config/configitembuilder.cpp
index 70963bc..ce27dc7 100644
--- a/lib/config/configitembuilder.cpp
+++ b/lib/config/configitembuilder.cpp
@@ -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>();
 





More information about the icinga-checkins mailing list