refactor(apiv2): rename APIErrors to Errors, move IsUserError to helper method
This commit is contained in:
@@ -140,10 +140,7 @@ namespace PluralKit.API
|
||||
var exc = ctx.Features.Get<IExceptionHandlerPathFeature>();
|
||||
|
||||
// handle common ISEs that are generated by invalid user input
|
||||
if (
|
||||
(exc.Error is InvalidCastException && exc.Error.Message.Contains("Newtonsoft.Json"))
|
||||
|| (exc.Error is FormatException && exc.Error.Message.Contains("was not recognized as a valid DateTime"))
|
||||
)
|
||||
if (exc.Error.IsUserError())
|
||||
{
|
||||
ctx.Response.StatusCode = 400;
|
||||
await ctx.Response.WriteAsync("{\"message\":\"400: Bad Request\",\"code\":0}");
|
||||
|
||||
Reference in New Issue
Block a user