fix(api): don't 500 on invalid PATCH body

This commit is contained in:
spiral
2022-03-23 14:26:54 -04:00
parent a20f0916ac
commit 97c14b20b0
3 changed files with 21 additions and 5 deletions

View File

@@ -127,6 +127,10 @@ public static class APIErrorHandlerExt
if (exc is FormatException && exc.Message.Contains("was not recognized as a valid DateTime"))
return true;
// this happens if a user sends an empty JSON object for PATCH (or a JSON object with no valid keys)
if (exc is InvalidPatchException)
return true;
// This may expanded at some point.
return false;
}