From 353f789e508493c88ad76d41adf38e83524ee6fd Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Sat, 28 Jul 2018 19:31:21 +0200 Subject: [PATCH] Increased exception messaging to track down Expensify error --- .../v5/Financial/FileExpenseClaim.aspx.cs | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/Site/Pages/v5/Financial/FileExpenseClaim.aspx.cs b/Site/Pages/v5/Financial/FileExpenseClaim.aspx.cs index 6c21f32e..d1322245 100644 --- a/Site/Pages/v5/Financial/FileExpenseClaim.aspx.cs +++ b/Site/Pages/v5/Financial/FileExpenseClaim.aspx.cs @@ -4,6 +4,7 @@ using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; +using System.Linq.Expressions; using System.Net; using System.Runtime.CompilerServices; using System.Security.Principal; @@ -462,7 +463,17 @@ namespace Swarmops.Frontend.Pages.v5.Financial using (WebClient client = new WebClient()) { - string receiptResource = client.DownloadString(recordList[loop].ReceiptUrl); + string receiptResource = string.Empty; + try + { + receiptResource = client.DownloadString(recordList[loop].ReceiptUrl); + } + catch (Exception innerException) + { + throw new Exception("Exception trying to download first Receipt URI: " + + recordList[loop].ReceiptUrl, innerException); + } + // We now have the web page which holds information about where the actual receipt is located. @@ -482,7 +493,15 @@ namespace Swarmops.Frontend.Pages.v5.Financial string fullyQualifiedFileName = Document.DailyStorageFolder + newGuidString; string relativeFileName = relativePath + newGuidString; - client.DownloadFile(actualReceiptUrl, fullyQualifiedFileName); + try + { + client.DownloadFile(actualReceiptUrl, fullyQualifiedFileName); + } + catch (Exception innerException) + { + throw new Exception("Exception trying to download receipt image: " + + actualReceiptUrl, innerException); + } recordList[loop].ReceiptFileNameHere = newGuidString; // If original file name ends in PDF, initiate conversion.