astral-api/Astral.Services/Exceptions/UsernameTakenException.cs

25 lines
832 B
C#
Raw Normal View History

2024-12-11 21:36:30 +01:00
// <copyright file="UsernameTakenException.cs" company="alveus.dev">
// Copyright (c) alveus.dev. All rights reserved. Licensed under the MIT License.
// </copyright>
using System.Net;
using Astral.Core.Exceptions;
using Astral.Services.Constants;
namespace Astral.Services.Exceptions;
/// <summary>
/// Thrown when there is an attempt to create a user with an already taken username.
/// </summary>
public class UsernameTakenException : ServiceException
{
/// <summary>
/// Initializes a new instance of the <see cref="UsernameTakenException" /> class.
/// </summary>
/// <param name="username">The username attempted.</param>
public UsernameTakenException(string username)
: base(ServiceErrorCodes.UsernameTaken, $"Username {username} has already been taken", HttpStatusCode.Conflict)
{
}
}