From 97a8869df1a54ae5ac58f2401c154761514f6601 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 24 Jul 2012 15:38:04 +0200 Subject: [PATCH] Use throw_exception() instead of throw. --- base/configobject.cpp | 4 ++-- base/dictionary.cpp | 4 ++-- base/variant.cpp | 4 ++-- jsonrpc/jsonrpcclient.cpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/base/configobject.cpp b/base/configobject.cpp index c5cd1d339..de3e24771 100644 --- a/base/configobject.cpp +++ b/base/configobject.cpp @@ -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(); @@ -298,7 +298,7 @@ void ConfigObject::RestoreObjects(const string& filename) Variant value = Variant::Deserialize(message); if (!value.IsObjectType()) - 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; diff --git a/base/dictionary.cpp b/base/dictionary.cpp index 01500c889..4864c1810 100644 --- a/base/dictionary.cpp +++ b/base/dictionary.cpp @@ -90,7 +90,7 @@ Dictionary::Ptr Dictionary::FromJson(cJSON *json) Dictionary::Ptr dictionary = boost::make_shared(); 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 +} diff --git a/base/variant.cpp b/base/variant.cpp index d1bed800c..f00d2fb04 100644 --- a/base/variant.cpp +++ b/base/variant.cpp @@ -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.")); } } diff --git a/jsonrpc/jsonrpcclient.cpp b/jsonrpc/jsonrpcclient.cpp index 28e872032..446de0b44 100644 --- a/jsonrpc/jsonrpcclient.cpp +++ b/jsonrpc/jsonrpcclient.cpp @@ -56,7 +56,7 @@ void JsonRpcClient::DataAvailableHandler(void) Variant value = Variant::Deserialize(jsonString); if (!value.IsObjectType()) - 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) {