]> granicus.if.org Git - icinga2/commitdiff
Don't use exceptions in CommentProcessor::Get*.
authorGunnar Beutner <gunnar.beutner@netways.de>
Thu, 31 Jan 2013 15:23:02 +0000 (16:23 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Thu, 31 Jan 2013 15:23:02 +0000 (16:23 +0100)
Fixes 3595

lib/icinga/commentprocessor.cpp

index 33423b94c0b05a3c378f8153299f0f807e1adebd..d6aa23999dc7aaf8ddfd579a5f696e45e27ddaf1 100644 (file)
@@ -66,7 +66,7 @@ void CommentProcessor::RemoveComment(const String& id)
        DynamicObject::Ptr owner = GetOwnerByCommentID(id);
 
        if (!owner)
-               throw_exception(invalid_argument("Comment ID does not exist."));
+               return;
 
        Dictionary::Ptr comments = owner->Get("comments");
 
@@ -81,7 +81,7 @@ String CommentProcessor::GetIDFromLegacyID(int id)
        map<int, String>::iterator it = m_LegacyCommentCache.find(id);
 
        if (it == m_LegacyCommentCache.end())
-               throw_exception(invalid_argument("Invalid legacy comment ID specified."));
+               return Empty;
 
        return it->second;
 }
@@ -98,7 +98,7 @@ Dictionary::Ptr CommentProcessor::GetCommentByID(const String& id)
        DynamicObject::Ptr owner = GetOwnerByCommentID(id);
 
        if (!owner)
-               throw_exception(invalid_argument("Comment ID does not exist."));
+               return Dictionary::Ptr();
 
        Dictionary::Ptr comments = owner->Get("comments");