diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-11-17 15:11:40 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-11-17 15:11:40 +0200 |
| commit | 69dbba322f6ef275134b7b214510e47b9fcdd0b0 (patch) | |
| tree | fd7a96fcf96ce86b7fa80f38161cb23ea140973c /Software/Visual_Studio/Tango.Web/Controllers | |
| parent | 6f0f2a7908884deab8aca33ec967d03c5e564060 (diff) | |
| download | Tango-69dbba322f6ef275134b7b214510e47b9fcdd0b0.tar.gz Tango-69dbba322f6ef275134b7b214510e47b9fcdd0b0.zip | |
IMplemented NSwag for DataStore WebAPI controller.
Implemented data store tool dsUtil.
Diffstat (limited to 'Software/Visual_Studio/Tango.Web/Controllers')
| -rw-r--r-- | Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs b/Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs index b3df0373e..0f69bf570 100644 --- a/Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs +++ b/Software/Visual_Studio/Tango.Web/Controllers/TangoController.cs @@ -60,6 +60,7 @@ namespace Tango.Web.Controllers LogManager.Log(ex, $"An error occurred while processing the request message on {controllerName + "/" + actionName}."); HttpStatusCode code = HttpStatusCode.InternalServerError; + HttpResponseException httpException = null; if (ex is ArgumentException || ex is InvalidDataException) { @@ -69,8 +70,18 @@ namespace Tango.Web.Controllers { code = HttpStatusCode.Unauthorized; } - - var httpException = new HttpResponseException(Request.CreateErrorResponse(code, ex.FlattenMessage(), ex)); + else if (ex is KeyNotFoundException) + { + code = HttpStatusCode.NotFound; + } + else if (ex is HttpResponseException httpResponseException) + { + httpException = httpResponseException; + } + else + { + httpException = new HttpResponseException(Request.CreateErrorResponse(code, ex.FlattenMessage(), ex)); + } #if DEBUG throw httpException; |
