mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 01:01:10 +00:00
37 lines
1.7 KiB
C#
37 lines
1.7 KiB
C#
#region ========================================================================= USING =====================================================================================
|
|
using Lumina.Presentation.Web.Common.Models.Common;
|
|
using System.Net;
|
|
#endregion
|
|
|
|
namespace Lumina.Presentation.Web.Common.Exceptions;
|
|
|
|
/// <summary>
|
|
/// Custom exception for interaction with the remote API.
|
|
/// </summary>
|
|
public class ApiException : Exception
|
|
{
|
|
#region ==================================================================== PROPERTIES =================================================================================
|
|
/// <summary>
|
|
/// Gets or sets the values of status codes defined for HTTP defined in RFC 2616 for HTTP 1.1.
|
|
/// </summary>
|
|
public HttpStatusCode HttpStatusCode { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the problem details represented by this exception.
|
|
/// </summary>
|
|
public ProblemDetailsModel? ProblemDetails { get; }
|
|
#endregion
|
|
|
|
#region ====================================================================== CTOR =====================================================================================
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="ApiException"/> class.
|
|
/// </summary>
|
|
/// <param name="problemDetails">The problem details object returned by the API.</param>
|
|
/// <param name="httpStatusCode">The HTTP status code returned by the API.</param>
|
|
public ApiException(ProblemDetailsModel? problemDetails, HttpStatusCode httpStatusCode) : base(problemDetails?.Title ?? "An error occurred.")
|
|
{
|
|
ProblemDetails = problemDetails;
|
|
HttpStatusCode = httpStatusCode;
|
|
}
|
|
#endregion
|
|
} |