aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs')
-rw-r--r--Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs15
1 files changed, 14 insertions, 1 deletions
diff --git a/Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs b/Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs
index b3df0373e..deaa7cf48 100644
--- a/Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs
+++ b/Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs
@@ -69,8 +69,21 @@ namespace Tango.Web.Controllers
{
code = HttpStatusCode.Unauthorized;
}
+ else if (ex is KeyNotFoundException)
+ {
+ code = HttpStatusCode.NotFound;
+ }
- var httpException = new HttpResponseException(Request.CreateErrorResponse(code, ex.FlattenMessage(), ex));
+ HttpResponseException httpException = null;
+
+ if (ex is HttpResponseException httpResponseException)
+ {
+ httpException = httpResponseException;
+ }
+ else
+ {
+ httpException = new HttpResponseException(Request.CreateErrorResponse(code, ex.FlattenMessage(), ex));
+ }
#if DEBUG
throw httpException;