summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2014-04-09 22:15:36 +0000
committerChris Wilson <chris+github@qwirx.com>2014-04-09 22:15:36 +0000
commit3b324ca62004b8ed56c3cba3ebdf61ef97b66324 (patch)
treec437fa90b904a060af17ae2ea8da446052ce6238 /bin
parent44ed218f0b219392a9e89647840c5a61c40858de (diff)
Remove NoObject reply, and adapt BackupQueries accordingly.
Diffstat (limited to 'bin')
-rw-r--r--bin/bbackupquery/BackupQueries.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/bin/bbackupquery/BackupQueries.cpp b/bin/bbackupquery/BackupQueries.cpp
index 413b5c1c..2c4c13d8 100644
--- a/bin/bbackupquery/BackupQueries.cpp
+++ b/bin/bbackupquery/BackupQueries.cpp
@@ -875,21 +875,27 @@ void BackupQueries::CommandGetObject(const std::vector<std::string> &args, const
{
// Request object
std::auto_ptr<BackupProtocolSuccess> getobj(mrConnection.QueryGetObject(id));
- if(getobj->GetObjectID() != BackupProtocolGetObject::NoObject)
- {
- // Stream that object out to the file
- std::auto_ptr<IOStream> objectStream(mrConnection.ReceiveStream());
- objectStream->CopyStreamTo(out);
+
+ // Stream that object out to the file
+ std::auto_ptr<IOStream> objectStream(mrConnection.ReceiveStream());
+ objectStream->CopyStreamTo(out);
- BOX_INFO("Object ID " << BOX_FORMAT_OBJECTID(id) <<
- " fetched successfully.");
- }
- else
+ BOX_INFO("Object ID " << BOX_FORMAT_OBJECTID(id) <<
+ " fetched successfully.");
+ }
+ catch(ConnectionException &e)
+ {
+ if(mrConnection.GetLastErrorType() == BackupProtocolError::Err_DoesNotExist)
{
BOX_ERROR("Object ID " << BOX_FORMAT_OBJECTID(id) <<
" does not exist on store.");
::unlink(args[1].c_str());
}
+ else
+ {
+ BOX_ERROR("Error occured fetching object.");
+ ::unlink(args[1].c_str());
+ }
}
catch(...)
{