Esempio n. 1
0
 protected async Task SendErrorAsync(HttpContext context, ApiException apiException)
 {
     context.Response.Clear();
     context.Response.ContentType = MediaTypeNames.Application.Json;
     context.Response.StatusCode  = apiException.StatusCode;
     var error     = apiException.ToError();
     var errorJson = JsonSerializer.Serialize(error, error.GetType());
     await context.Response.WriteAsync(errorJson);
 }