Browse Source

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

Andrew Klopper 8 years ago
parent
commit
771a107cb5
1 changed files with 10 additions and 1 deletions
  1. 10 1
      BulkPrintingAPI/Controllers/BatchesController.cs

+ 10 - 1
BulkPrintingAPI/Controllers/BatchesController.cs

86
 
86
 
87
             if (!batch.ReadyForDownload)
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
             return Ok(batch);
101
             return Ok(batch);