summaryrefslogtreecommitdiff
path: root/cpp/src/IcePatch2Lib/ClientUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/IcePatch2Lib/ClientUtil.cpp')
-rw-r--r--cpp/src/IcePatch2Lib/ClientUtil.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/cpp/src/IcePatch2Lib/ClientUtil.cpp b/cpp/src/IcePatch2Lib/ClientUtil.cpp
index 9f7be8b649f..a2f179a18ac 100644
--- a/cpp/src/IcePatch2Lib/ClientUtil.cpp
+++ b/cpp/src/IcePatch2Lib/ClientUtil.cpp
@@ -119,7 +119,7 @@ Decompressor::add(const LargeFileInfo& info)
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
if(!_exception.empty())
{
- throw _exception;
+ throw runtime_error(_exception);
}
_files.push_back(info);
notify();
@@ -131,7 +131,7 @@ Decompressor::exception() const
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
if(!_exception.empty())
{
- throw _exception;
+ throw runtime_error(_exception);
}
}
@@ -144,7 +144,7 @@ Decompressor::log(FILE* fp)
{
if(fputc('+', fp) == EOF || !writeFileInfo(fp, *p))
{
- throw "error writing log file:\n" + IceUtilInternal::lastErrorToString();
+ throw runtime_error("error writing log file:\n" + IceUtilInternal::lastErrorToString());
}
}
@@ -188,11 +188,11 @@ Decompressor::run()
setFileFlags(_dataDir + '/' + info.path, info);
remove(_dataDir + '/' + info.path + ".bz2");
}
- catch(const string& ex)
+ catch(const std::exception& ex)
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
_destroy = true;
- _exception = ex;
+ _exception = ex.what();
return;
}
}
@@ -211,13 +211,13 @@ PatcherI::PatcherI(const CommunicatorPtr& communicator, const PatcherFeedbackPtr
string clientProxy = communicator->getProperties()->getProperty(clientProxyProperty);
if(clientProxy.empty())
{
- throw "property `IcePatch2Client.Proxy' is not set";
+ throw runtime_error("property `IcePatch2Client.Proxy' is not set");
}
FileServerPrx server = FileServerPrx::checkedCast(communicator->stringToProxy(clientProxy));
if(!server)
{
- throw "proxy `" + clientProxy + "' is not a file server.";
+ throw runtime_error("proxy `" + clientProxy + "' is not a file server.");
}
init(server);
@@ -293,9 +293,9 @@ PatcherI::prepare()
{
loadFileInfoSeq(_dataDir, _localFiles);
}
- catch(const string& ex)
+ catch(const exception& ex)
{
- thorough = _feedback->noFileSummary(ex);
+ thorough = _feedback->noFileSummary(ex.what());
if(!thorough)
{
return false;
@@ -337,7 +337,7 @@ PatcherI::prepare()
ByteSeqSeq checksumSeq = _serverCompress->getChecksumSeq();
if(checksumSeq.size() != 256)
{
- throw string("server returned illegal value");
+ throw runtime_error("server returned illegal value");
}
while(true)
@@ -471,7 +471,7 @@ PatcherI::prepare()
_log = IceUtilInternal::fopen(pathLog, "w");
if(!_log)
{
- throw "cannot open `" + pathLog + "' for writing:\n" + IceUtilInternal::lastErrorToString();
+ throw runtime_error("cannot open `" + pathLog + "' for writing:\n" + IceUtilInternal::lastErrorToString());
}
return true;
@@ -598,7 +598,7 @@ PatcherI::init(const FileServerPrx& server)
{
if(_dataDir.empty())
{
- throw string("no data directory specified");
+ throw runtime_error("no data directory specified");
}
Ice::CommunicatorPtr communicator = server->ice_getCommunicator();
@@ -632,7 +632,7 @@ PatcherI::init(const FileServerPrx& server)
string cwd;
if(IceUtilInternal::getcwd(cwd) != 0)
{
- throw "cannot get the current directory:\n" + IceUtilInternal::lastErrorToString();
+ throw runtime_error("cannot get the current directory:\n" + IceUtilInternal::lastErrorToString());
}
const_cast<string&>(_dataDir) = simplify(cwd + '/' + _dataDir);
}
@@ -656,7 +656,7 @@ PatcherI::removeFiles(const LargeFileInfoSeq& files)
remove(_dataDir + '/' + p->path);
if(fputc('-', _log) == EOF || ! writeFileInfo(_log, *p))
{
- throw "error writing log file:\n" + IceUtilInternal::lastErrorToString();
+ throw runtime_error("error writing log file:\n" + IceUtilInternal::lastErrorToString());
}
}
catch(...)
@@ -753,7 +753,7 @@ PatcherI::updateFilesInternal(const LargeFileInfoSeq& files, const DecompressorP
createDirectoryRecursive(_dataDir + '/' + p->path);
if(fputc('+', _log) == EOF || !writeFileInfo(_log, *p))
{
- throw "error writing log file:\n" + IceUtilInternal::lastErrorToString();
+ throw runtime_error("error writing log file:\n" + IceUtilInternal::lastErrorToString());
}
}
else // Regular file.
@@ -769,7 +769,7 @@ PatcherI::updateFilesInternal(const LargeFileInfoSeq& files, const DecompressorP
FILE* fp = IceUtilInternal::fopen(path, "wb");
if(fp == 0)
{
- throw "cannot open `" + path +"' for writing:\n" + IceUtilInternal::lastErrorToString();
+ throw runtime_error("cannot open `" + path +"' for writing:\n" + IceUtilInternal::lastErrorToString());
}
fclose(fp);
}
@@ -794,7 +794,7 @@ PatcherI::updateFilesInternal(const LargeFileInfoSeq& files, const DecompressorP
FILE* fileBZ2 = IceUtilInternal::fopen(pathBZ2, "wb");
if(fileBZ2 == 0)
{
- throw "cannot open `" + pathBZ2 + "' for writing:\n" + IceUtilInternal::lastErrorToString();
+ throw runtime_error("cannot open `" + pathBZ2 + "' for writing:\n" + IceUtilInternal::lastErrorToString());
}
try
@@ -848,17 +848,17 @@ PatcherI::updateFilesInternal(const LargeFileInfoSeq& files, const DecompressorP
}
catch(const FileAccessException& ex)
{
- throw "error from IcePatch2 server for `" + p->path + "': " + ex.reason;
+ throw runtime_error("error from IcePatch2 server for `" + p->path + "': " + ex.reason);
}
if(bytes.empty())
{
- throw "size mismatch for `" + p->path + "'";
+ throw runtime_error("size mismatch for `" + p->path + "'");
}
if(fwrite(reinterpret_cast<char*>(&bytes[0]), bytes.size(), 1, fileBZ2) != 1)
{
- throw ": cannot write `" + pathBZ2 + "':\n" + IceUtilInternal::lastErrorToString();
+ throw runtime_error(": cannot write `" + pathBZ2 + "':\n" + IceUtilInternal::lastErrorToString());
}
// 'bytes' is always returned with size '_chunkSize'. When a file is smaller than '_chunkSize'