galaeth-draft/Galaeth.Services/Exceptions/UsernameTakenException.cs

21 lines
666 B
C#
Raw Normal View History

2024-11-17 10:31:01 +01:00
using System.Net;
using Galaeth.Core.Exceptions;
using Galaeth.Services.Constants;
namespace Galaeth.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)
{
}
}