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>();
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;
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));
}
return json;
-}
\ No newline at end of file
+}
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
} 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."));
}
}
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) {