You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/src/Lidarr.Http/ErrorManagement/ErrorModel.cs

33 lines
879 B

using System.Net;
using System.Threading.Tasks;
using Lidarr.Http.Exceptions;
using Microsoft.AspNetCore.Http;
using NzbDrone.Common.Serializer;
namespace Lidarr.Http.ErrorManagement
{
public class ErrorModel
{
public string Message { get; set; }
public string Description { get; set; }
public object Content { get; set; }
public ErrorModel(ApiException exception)
{
Message = exception.Message;
Content = exception.Content;
}
public ErrorModel()
{
}
public Task WriteToResponse(HttpResponse response, HttpStatusCode statusCode = HttpStatusCode.InternalServerError)
{
response.StatusCode = (int)statusCode;
response.ContentType = "application/json";
return STJson.SerializeAsync(this, response.Body);
}
}
}