浏览代码

Catch exceptions when viewing a single batch and simply return readyForDownload=false if readyForDownload is false and the download fails again.

Andrew Klopper 8 年之前
父节点
当前提交
771a107cb5
共有 1 个文件被更改,包括 10 次插入1 次删除
  1. 10 1
      BulkPrintingAPI/Controllers/BatchesController.cs

+ 10 - 1
BulkPrintingAPI/Controllers/BatchesController.cs

@@ -86,7 +86,16 @@ namespace BulkPrintingAPI.Controllers
86 86
 
87 87
             if (!batch.ReadyForDownload)
88 88
             {
89
-                await Utils.DownloadVouchersAsync(_sftpOptions, _context, _logger, batch);
89
+                try
90
+                {
91
+                    await Utils.DownloadVouchersAsync(_sftpOptions, _context, _logger, batch);
92
+                }
93
+                catch (Exception e)
94
+                {
95
+                    _logger.LogError(string.Format(
96
+                        "Failed to download vouchers for {0} batchId={1}: {2}",
97
+                        credentials.ToString(), batch.Id, e.Message));
98
+                }
90 99
             }
91 100
 
92 101
             return Ok(batch);