galaeth-draft/Galaeth.Services/Exceptions/UsernameTakenException.cs
2024-11-17 09:31:01 +00:00

21 lines
666 B
C#

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)
{
}
}