refactor: for maintenance mode, return the standard error
This commit is contained in:
@ -71,6 +71,14 @@ public class CustomExceptionHandlerMiddleware(RequestDelegate next, ILogger<Cust
|
||||
problemDetails.Type = "https://tools.ietf.org/html/rfc9110#section-15.5.2";
|
||||
problemDetails.Title = "Unauthorized access.";
|
||||
break;
|
||||
case ServerUnavailableException unavailableException:
|
||||
problemDetails.Status = StatusCodes.Status503ServiceUnavailable;
|
||||
problemDetails.Type = "https://datatracker.ietf.org/doc/html/rfc9110#section-15.6.4";
|
||||
problemDetails.Title = "Server unavailable.";
|
||||
problemDetails.Detail = unavailableException.Message;
|
||||
if (unavailableException.AddRetryAfter)
|
||||
context.Response.Headers.RetryAfter = "600";
|
||||
break;
|
||||
}
|
||||
|
||||
if (problemDetails.Status == StatusCodes.Status500InternalServerError)
|
||||
|
Reference in New Issue
Block a user