]> granicus.if.org Git - icinga2/commitdiff
Use throw_exception() instead of throw.
authorGunnar Beutner <gunnar.beutner@netways.de>
Tue, 24 Jul 2012 13:38:04 +0000 (15:38 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Tue, 24 Jul 2012 13:38:04 +0000 (15:38 +0200)
base/configobject.cpp
base/dictionary.cpp
base/variant.cpp
jsonrpc/jsonrpcclient.cpp

index c5cd1d33940037d440443bbe8062a2e6f78a269f..de3e24771b870f3e2081ed34f9fb80c2eb360ba7 100644 (file)
@@ -239,7 +239,7 @@ void ConfigObject::DumpObjects(const string& filename)
        fp.open(filename.c_str());
 
        if (!fp)
-               throw runtime_error("Could not open retention.dat file");
+               throw_exception(runtime_error("Could not open retention.dat file"));
 
        FIFO::Ptr fifo = boost::make_shared<FIFO>();
 
@@ -298,7 +298,7 @@ void ConfigObject::RestoreObjects(const string& filename)
                Variant value = Variant::Deserialize(message);
 
                if (!value.IsObjectType<Dictionary>())
-                       throw runtime_error("JSON objects in the retention file must be dictionaries.");
+                       throw_exception(runtime_error("JSON objects in the retention file must be dictionaries."));
 
                Dictionary::Ptr persistentObject = value;
 
index 01500c8891e29c1b621b12e3e824d30f0ef46a58..4864c18107c588773c14f381b4c3dd15f1caae8a 100644 (file)
@@ -90,7 +90,7 @@ Dictionary::Ptr Dictionary::FromJson(cJSON *json)
        Dictionary::Ptr dictionary = boost::make_shared<Dictionary>();
 
        if (json->type != cJSON_Object)
-               throw invalid_argument("JSON type must be cJSON_Object.");
+               throw_exception(invalid_argument("JSON type must be cJSON_Object."));
 
        for (cJSON *i = json->child; i != NULL; i = i->next) {
                dictionary->Set(i->string, Variant::FromJson(i));
@@ -122,4 +122,4 @@ cJSON *Dictionary::ToJson(void) const
        }
 
        return json;
-}
\ No newline at end of file
+}
index d1bed800c3ad10cd0e2c183e33b132c5f2fb2203..f00d2fb047094bda224bdd072d4fdf3c0927b9fe 100644 (file)
@@ -57,7 +57,7 @@ Variant Variant::FromJson(cJSON *json)
        else if (json->type == cJSON_NULL)
                return Variant();
        else
-               throw invalid_argument("Unsupported JSON type.");
+               throw_exception(invalid_argument("Unsupported JSON type."));
 }
 
 string Variant::Serialize(void) const
@@ -99,7 +99,7 @@ cJSON *Variant::ToJson(void) const
        } else if (m_Value.type() == typeid(boost::blank)) {
                return cJSON_CreateNull();
        } else {
-               throw runtime_error("Invalid variant type.");
+               throw_exception(runtime_error("Invalid variant type."));
        }
 }
 
index 28e8720327e787584c0b6a83ba48414eb76c0181..446de0b447a47539bbfad6aefac7fd6438edc81c 100644 (file)
@@ -56,7 +56,7 @@ void JsonRpcClient::DataAvailableHandler(void)
                        Variant value = Variant::Deserialize(jsonString);
 
                        if (!value.IsObjectType<Dictionary>())
-                               throw invalid_argument("JSON-RPC message must be a dictionary.");
+                               throw_exception(invalid_argument("JSON-RPC message must be a dictionary."));
 
                        OnNewMessage(GetSelf(), MessagePart(value));
                } catch (const exception& ex) {