namespace Managing.Core.Exceptions;
///
/// Exception thrown when validation fails (maps to 400 Bad Request)
///
public class ValidationException : Exception
{
public ValidationException(string message) : base(message)
{
}
public ValidationException(string message, Exception innerException) : base(message, innerException)
{
}
}
///
/// Exception thrown when a resource is not found (maps to 404 Not Found)
///
public class NotFoundException : Exception
{
public NotFoundException(string message) : base(message)
{
}
public NotFoundException(string resourceType, string identifier)
: base($"{resourceType} with identifier '{identifier}' was not found.")
{
}
}
///
/// Exception thrown when the user does not have permission (maps to 403 Forbidden)
///
public class ForbiddenException : Exception
{
public ForbiddenException(string message) : base(message)
{
}
public ForbiddenException() : base("You do not have permission to access this resource.")
{
}
}
///
/// Exception thrown when there is a conflict with the current state (maps to 409 Conflict)
///
public class ConflictException : Exception
{
public ConflictException(string message) : base(message)
{
}
}
///
/// Exception thrown when a rate limit is exceeded (maps to 429 Too Many Requests)
///
public class RateLimitExceededException : Exception
{
public RateLimitExceededException(string message) : base(message)
{
}
public RateLimitExceededException() : base("Rate limit exceeded. Please try again later.")
{
}
}
///
/// Exception thrown when an external service is unavailable (maps to 503 Service Unavailable)
///
public class ServiceUnavailableException : Exception
{
public ServiceUnavailableException(string message) : base(message)
{
}
}