From 00a491d93733d4625ad329b2ba8237f445364b3f Mon Sep 17 00:00:00 2001 From: Mirta Date: Wed, 30 Dec 2020 16:39:52 +0200 Subject: merge --- .../Tango.Web/Controllers/TangoController.cs | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs') diff --git a/Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs b/Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs index deaa7cf48..28637d97c 100644 --- a/Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs +++ b/Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Net; using System.Net.Http; @@ -61,7 +60,7 @@ namespace Tango.Web.Controllers HttpStatusCode code = HttpStatusCode.InternalServerError; - if (ex is ArgumentException || ex is InvalidDataException) + if (ex is ArgumentException) { code = HttpStatusCode.BadRequest; } @@ -69,21 +68,8 @@ namespace Tango.Web.Controllers { code = HttpStatusCode.Unauthorized; } - else if (ex is KeyNotFoundException) - { - code = HttpStatusCode.NotFound; - } - HttpResponseException httpException = null; - - if (ex is HttpResponseException httpResponseException) - { - httpException = httpResponseException; - } - else - { - httpException = new HttpResponseException(Request.CreateErrorResponse(code, ex.FlattenMessage(), ex)); - } + var httpException = new HttpResponseException(Request.CreateErrorResponse(code, ex.FlattenMessage())); #if DEBUG throw httpException; @@ -97,7 +83,7 @@ namespace Tango.Web.Controllers if (expandedExceptionValues != null) { - expandedExceptionValues["StackTrace"] = ""; + expandedExceptionValues["StackTrace"] = "StackTrace not provided."; } } #endif -- cgit v1.3.1