42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
// <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; }
|
|
}
|