Better error handling for .xlsx import

This commit is contained in:
2015-06-18 13:29:06 -04:00
parent d035d3bf2e
commit 89548b44db
2 changed files with 10 additions and 0 deletions
+5
View File
@@ -187,6 +187,11 @@ namespace MileageTraker.Web.Controllers
// todo: delete file? // todo: delete file?
return View(logImports.ToList()); return View(logImports.ToList());
} }
catch (OutOfMemoryException)
{
TempData["StatusMessage"] = "Problem reading excel document - please verify that the document is in Excel 97-2003 Workbook (.xls) format";
TempData["StatusMessage-Type"] = "alert-error";
}
catch (Exception ex) catch (Exception ex)
{ {
TempData["StatusMessage"] = "Problem reading excel document: " + ex.Message; TempData["StatusMessage"] = "Problem reading excel document: " + ex.Message;
+5
View File
@@ -266,6 +266,11 @@ namespace MileageTraker.Web.Controllers
// todo: delete file? // todo: delete file?
return View(logImports.ToList()); return View(logImports.ToList());
} }
catch (OutOfMemoryException)
{
TempData["StatusMessage"] = "Problem reading excel document - please verify that the document is in Excel 97-2003 Workbook (.xls) format";
TempData["StatusMessage-Type"] = "alert-error";
}
catch (Exception ex) catch (Exception ex)
{ {
TempData["StatusMessage"] = "Problem reading excel document: " + ex.Message; TempData["StatusMessage"] = "Problem reading excel document: " + ex.Message;