Use throw_exception() instead of throw.

This commit is contained in:
Gunnar Beutner 2012-07-24 15:38:04 +02:00
parent 928804b5f3
commit 97a8869df1
4 changed files with 7 additions and 7 deletions

View 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;

View 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;
}
}

View 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."));
}
}

View 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) {