mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-01-06 15:44:26 +01:00
[Greenfield] if some json property are invalid, throw nice error instead of an exception (fix #2795)
This commit is contained in:
@@ -14,7 +14,7 @@ namespace BTCPayServer.Filters
|
||||
{
|
||||
if (context.Exception is NBitcoin.JsonConverters.JsonObjectException jsonObject)
|
||||
{
|
||||
context.Result = new ObjectResult(new GreenfieldValidationError(jsonObject.Path, jsonObject.Message)) { StatusCode = 400 };
|
||||
context.Result = new ObjectResult(new[] { new GreenfieldValidationError(jsonObject.Path, jsonObject.Message) }) { StatusCode = 422 };
|
||||
context.ExceptionHandled = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user