mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-30 04:04:21 +01:00
27 lines
821 B
C#
27 lines
821 B
C#
using System;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace BTCPayServer.Controllers.GreenField
|
|
{
|
|
public static class GreenFieldUtils
|
|
{
|
|
public static IActionResult GetValidationResponse(this ControllerBase controller)
|
|
{
|
|
return controller.UnprocessableEntity( new ValidationProblemDetails(controller.ModelState));
|
|
}
|
|
public static IActionResult GetExceptionResponse(this ControllerBase controller, Exception e)
|
|
{
|
|
return GetGeneralErrorResponse(controller, e.Message);
|
|
}
|
|
|
|
public static IActionResult GetGeneralErrorResponse(this ControllerBase controller, string error)
|
|
{
|
|
return controller.BadRequest( new ProblemDetails()
|
|
{
|
|
Detail = error
|
|
});
|
|
}
|
|
|
|
}
|
|
}
|