Added exception logging to UploadFileHandler

This commit is contained in:
Rick Falkvinge
2018-10-30 20:42:33 +01:00
parent 0658a87ae2
commit 234651e5d1
4 changed files with 48 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UITests.aspx.cs" Inherits="Swarmops.Frontend.Automation.UITests" %>
+17
View File
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Swarmops.Frontend.Automation
{
public partial class UITests : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
+15
View File
@@ -0,0 +1,15 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Swarmops.Frontend.Automation {
public partial class UITests {
}
}
+15 -1
View File
@@ -119,9 +119,12 @@ namespace Swarmops.Frontend.Automation
Stream inputStream = context.Request.Files[0].InputStream;
string fullName = Document.StorageRoot + Path.GetFileName(fileName);
throw new NotImplementedException(
Exception exception = new NotImplementedException(
"We should never get to partial upload. If we do, something is very very unexpected and this needs to be implemented.");
SupportFunctions.LogException("UploadFileHandler-Partial", exception);
throw exception;
//using (var fs = new FileStream(fullName, FileMode.Append, FileAccess.Write))
//{
// var buffer = new byte[1024];
@@ -149,6 +152,8 @@ namespace Swarmops.Frontend.Automation
for (int i = 0; i < context.Request.Files.Count; i++)
{
try
{
HttpPostedFile file = context.Request.Files[i];
string fullName = Path.GetFileName(file.FileName);
string clientFileName = string.Empty;
@@ -335,6 +340,15 @@ namespace Swarmops.Frontend.Automation
statuses.Add(new FilesStatus(fullName, file.ContentLength));
}
}
catch (Exception loggableException)
{
SupportFunctions.LogException("UploadFileHandler", loggableException);
throw loggableException;
}
}
if (pdfsForConversion.Count > 0)