astral-api/Astral.Core/Exceptions/ServiceExceptions.cs

43 lines
1.2 KiB
C#
Raw Permalink Normal View History

2024-12-11 21:36:30 +01:00
// <copyright file="ServiceExceptions.cs" company="alveus.dev">
// Copyright (c) alveus.dev. All rights reserved. Licensed under the MIT License.
// </copyright>
using System.Net;
namespace Astral.Core.Exceptions;
/// <summary>
/// Service exception to be fed back into the response.
/// </summary>
public class ServiceException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="ServiceException" /> class.
/// </summary>
/// <param name="errorCode">Error code to provide.</param>
/// <param name="errorMessage">Error message to provide.</param>
/// <param name="httpStatusCode">The http status code to provide.</param>
protected ServiceException(string errorCode, string errorMessage, HttpStatusCode httpStatusCode)
: base(errorMessage)
{
ErrorCode = errorCode;
ErrorMessage = errorMessage;
HttpStatusCode = httpStatusCode;
}
/// <summary>
/// Standard error code.
/// </summary>
public string ErrorCode { get; }
/// <summary>
/// Error message.
/// </summary>
public string ErrorMessage { get; }
/// <summary>
/// Http Status Code.
/// </summary>
public HttpStatusCode HttpStatusCode { get; }
}