add UserRendererService and improve errors
This commit is contained in:
parent
6114f384a0
commit
f674d059fd
14 changed files with 607 additions and 25 deletions
|
@ -45,7 +45,7 @@ public class ErrorHandlerMiddleware(ILogger baseLogger) : IMiddleware
|
|||
await ctx.Response.WriteAsync(JsonConvert.SerializeObject(new HttpApiError
|
||||
{
|
||||
Status = (int)ae.StatusCode,
|
||||
Code = ErrorCode.GenericApiError,
|
||||
Code = ae.ErrorCode,
|
||||
Message = ae.Message,
|
||||
}));
|
||||
return;
|
||||
|
@ -76,18 +76,12 @@ public class ErrorHandlerMiddleware(ILogger baseLogger) : IMiddleware
|
|||
public record HttpApiError
|
||||
{
|
||||
public required int Status { get; init; }
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public required ErrorCode Code { get; init; }
|
||||
|
||||
public required string Message { get; init; }
|
||||
|
||||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string[]? Scopes { get; init; }
|
||||
}
|
||||
|
||||
public enum ErrorCode
|
||||
{
|
||||
InternalServerError,
|
||||
Forbidden,
|
||||
BadRequest,
|
||||
AuthenticationError,
|
||||
GenericApiError,
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue