浏览代码

2008-12-23 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

	Added try-catch block in the loop in showFiles() to continue the
	operation even if the exception occurred in one file.
	* src/main.cc (showFiles)
Tatsuhiro Tsujikawa 17 年之前
父节点
当前提交
3a7edb7680
共有 2 个文件被更改,包括 17 次插入7 次删除
  1. 6 0
      ChangeLog
  2. 11 7
      src/main.cc

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+2008-12-23  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
+
+	Added try-catch block in the loop in showFiles() to continue the
+	operation even if the exception occurred in one file.
+	* src/main.cc (showFiles)
+
 2008-12-20  Tatsuhiro Tsujikawa  <t-tujikawa@users.sourceforge.net>
 
 	Made messages in showFiles() translatable.

+ 11 - 7
src/main.cc

@@ -127,13 +127,17 @@ static void showFiles(const std::deque<std::string>& uris, const Option* op)
       i != uris.end(); ++i) {
     printf(MSG_SHOW_FILES, (*i).c_str());
     printf("\n");
-    if(dt.guessTorrentFile(*i)) {
-      showTorrentFile(*i);
-    } else if(dt.guessMetalinkFile(*i)) {
-      showMetalinkFile(*i, op);
-    } else {
-      printf(MSG_NOT_TORRENT_METALINK);
-      printf("\n\n");
+    try {
+      if(dt.guessTorrentFile(*i)) {
+	showTorrentFile(*i);
+      } else if(dt.guessMetalinkFile(*i)) {
+	showMetalinkFile(*i, op);
+      } else {
+	printf(MSG_NOT_TORRENT_METALINK);
+	printf("\n\n");
+      }
+    } catch(RecoverableException& e) {
+      std::cout << e.stackTrace() << std::endl;
     }
   }
 }