namespace AiDevProject.Core.Exceptions;
///
/// Base application exception.
///
public class AppException : Exception
{
public int StatusCode { get; }
public bool IsOperational { get; }
public AppException(string message, int statusCode = 500, bool isOperational = true)
: base(message)
{
StatusCode = statusCode;
IsOperational = isOperational;
}
}
///
/// Validation error.
///
public class ValidationError : AppException
{
public ValidationError(string message) : base(message, 400) { }
}
///
/// Resource not found.
///
public class NotFoundError : AppException
{
public NotFoundError(string resource) : base($"{resource} not found", 404) { }
}
///
/// Authentication failed.
///
public class AuthenticationError : AppException
{
public AuthenticationError() : base("Authentication failed", 401) { }
}