Cleaned up exception handling.

This commit is contained in:
Gunnar Beutner 2012-08-14 09:51:11 +02:00
parent e3661898ea
commit a9610ecb9e
3 changed files with 6 additions and 4 deletions

View File

@ -39,7 +39,7 @@ DynamicObject::DynamicObject(const Dictionary::Ptr& serializedObject)
RegisterAttribute("methods", Attribute_Config);
if (!serializedObject->Contains("configTx"))
throw invalid_argument("Serialized object must contain a config snapshot.");
throw_exception(invalid_argument("Serialized object must contain a config snapshot."));
/* apply config state from the config item/remote update;
* The DynamicObject::Create function takes care of restoring
@ -406,7 +406,8 @@ void DynamicObject::DumpObjects(const String& filename)
}
}
rename(tempFilename.CStr(), filename.CStr());
if (rename(tempFilename.CStr(), filename.CStr()) < 0)
throw_exception(PosixException("rename() failed", errno));
}
void DynamicObject::RestoreObjects(const String& filename)

View File

@ -104,7 +104,8 @@ void Object::PrintMemoryProfile(void)
}
dictfp.close();
rename("dictionaries.dump.tmp", "dictionaries.dump");
if (rename("dictionaries.dump.tmp", "dictionaries.dump") < 0)
throw_exception(PosixException("rename() failed", errno));
String type;
int count;

View File

@ -284,7 +284,7 @@ double Utility::GetTime(void)
struct timeval tv;
if (gettimeofday(&tv, NULL) < 0)
throw PosixException("gettimeofday() failed", errno);
throw_exception(PosixException("gettimeofday() failed", errno));
return tv.tv_sec + tv.tv_usec / 1000000.0;
#endif /* _WIN32 */