aboutsummaryrefslogtreecommitdiff
path: root/src/Web
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2021-03-28 19:16:15 +0300
committertranstrike <transtrike@gmail.com>2021-03-28 19:16:15 +0300
commita789a23c3c8ddde8188f2da40402a1803f838f89 (patch)
treedaff292b6562a7f49cc2900e249a77243b8919e9 /src/Web
parent4f6d554f95afac9c4eb7358596e4a7ce3aeb5a30 (diff)
parent15904cb3d2ef9442b682322353c378ab321520e5 (diff)
downloadDevHive-a789a23c3c8ddde8188f2da40402a1803f838f89.tar
DevHive-a789a23c3c8ddde8188f2da40402a1803f838f89.tar.gz
DevHive-a789a23c3c8ddde8188f2da40402a1803f838f89.zip
Dev changes merged into ProfilePicLayer branch
Diffstat (limited to 'src/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",