aboutsummaryrefslogtreecommitdiff
path: root/src/Web/DevHive.Web
diff options
context:
space:
mode:
Diffstat (limited to 'src/Web/DevHive.Web')
-rw-r--r--src/Web/DevHive.Web/Middleware/ExceptionMiddleware.cs15
-rw-r--r--src/Web/DevHive.Web/appsettings.json2
2 files changed, 10 insertions, 7 deletions
diff --git a/src/Web/DevHive.Web/Middleware/ExceptionMiddleware.cs b/src/Web/DevHive.Web/Middleware/ExceptionMiddleware.cs
index f159b69..e2521bd 100644
--- a/src/Web/DevHive.Web/Middleware/ExceptionMiddleware.cs
+++ b/src/Web/DevHive.Web/Middleware/ExceptionMiddleware.cs
@@ -2,7 +2,7 @@ using System;
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
+using Newtonsoft.Json;
namespace DevHive.Web.Middleware
{
@@ -32,11 +32,14 @@ namespace DevHive.Web.Middleware
context.Response.ContentType = "application/json";
context.Response.StatusCode = (int)HttpStatusCode.BadRequest;
- return context.Response.WriteAsync(new
- {
- context.Response.StatusCode,
- exception.Message
- }.ToString());
+ // Made to ressemble the formatting of property validation errors (like [MinLength(3)])
+ string message = JsonConvert.SerializeObject(new {
+ errors = new {
+ Exception = new String[] { exception.Message }
+ }
+ });
+
+ return context.Response.WriteAsync(message);
}
}
}
diff --git a/src/Web/DevHive.Web/appsettings.json b/src/Web/DevHive.Web/appsettings.json
index fcf9805..036af82 100644
--- a/src/Web/DevHive.Web/appsettings.json
+++ b/src/Web/DevHive.Web/appsettings.json
@@ -5,7 +5,7 @@
"audience": ""
},
"ConnectionStrings": {
- "DEV": "Server=localhost;Port=5432;Database=API;User Id=postgres;Password=;"
+ "DEV": "Server=localhost;Port=5432;Database=DevHive_API;User Id=postgres;Password=;"
},
"Cloud": {
"cloudName": "devhive",