#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.DTO.Common;
using System;
using System.Net;
#endregion
namespace Lumina.Presentation.Web.Common.Exceptions;
///
/// Custom exception for interaction with the remote API.
///
public class ApiException : Exception
{
///
/// Gets or sets the values of status codes defined for HTTP defined in RFC 2616 for HTTP 1.1.
///
public HttpStatusCode HttpStatusCode { get; set; }
///
/// Gets or sets the problem details represented by this exception.
///
public ProblemDetailsDto? ProblemDetails { get; }
///
/// Gets or sets the absolute path of the API endpoint that produced this exception.
///
public string? RequestPath { get; }
///
/// Initializes a new instance of the class.
///
/// The problem details object returned by the API.
/// The HTTP status code returned by the API.
/// The absolute path of the API endpoint that produced this exception.
public ApiException(ProblemDetailsDto? problemDetails, HttpStatusCode httpStatusCode, string? requestPath = null) : base(problemDetails?.Title ?? "An error occurred.")
{
ProblemDetails = problemDetails;
HttpStatusCode = httpStatusCode;
RequestPath = requestPath;
}
}