[Box Backup-commit] COMMIT r1271 - box/chris/general/bin/bbackupquery

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Thu, 08 Feb 2007 21:57:17 +0000


Author: chris
Date: 2007-02-08 21:57:17 +0000 (Thu, 08 Feb 2007)
New Revision: 1271

Modified:
   box/chris/general/bin/bbackupquery/BackupQueries.cpp
Log:
Catch exceptions during restore.


Modified: box/chris/general/bin/bbackupquery/BackupQueries.cpp
===================================================================
--- box/chris/general/bin/bbackupquery/BackupQueries.cpp	2007-01-25 20:48:12 UTC (rev 1270)
+++ box/chris/general/bin/bbackupquery/BackupQueries.cpp	2007-02-08 21:57:17 UTC (rev 1271)
@@ -1909,11 +1909,34 @@
 #endif
 
 	// Go and restore...
-	switch(BackupClientRestore(mrConnection, dirID, localName.c_str(), 
-		true /* print progress dots */, restoreDeleted, 
-		false /* don't undelete after restore! */, 
-		opts['r'] /* resume? */))
+	int result;
+
+	try
 	{
+		result = BackupClientRestore(mrConnection, dirID, 
+			localName.c_str(), 
+			true /* print progress dots */, restoreDeleted, 
+			false /* don't undelete after restore! */, 
+			opts['r'] /* resume? */);
+	}
+	catch (BoxException &e)
+	{
+		::syslog(LOG_ERR, "Failed to restore: %s", e.what());
+		return;
+	}
+	catch(std::exception &e)
+	{
+		::syslog(LOG_ERR, "Failed to restore: %s", e.what());
+		return;
+	}
+	catch(...)
+	{
+		::syslog(LOG_ERR, "Failed to restore: unknown error");
+		return;
+	}
+
+	switch(result)
+	{
 	case Restore_Complete:
 		printf("Restore complete\n");
 		break;