video_url_validator/
error.rs

1//! Error types for the video URL validator
2
3use std::fmt;
4
5/// Errors that can occur during URL validation
6#[derive(Debug, Clone, PartialEq, Eq)]
7pub enum ValidationError {
8    /// The URL format is invalid
9    InvalidFormat,
10    /// The platform is not supported
11    UnsupportedPlatform,
12    /// The URL is empty or contains invalid characters
13    MalformedUrl,
14}
15
16impl fmt::Display for ValidationError {
17    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18        match self {
19            ValidationError::InvalidFormat => write!(f, "Invalid URL format"),
20            ValidationError::UnsupportedPlatform => write!(f, "Unsupported video platform"),
21            ValidationError::MalformedUrl => write!(f, "Malformed URL"),
22        }
23    }
24}
25
26impl std::error::Error for ValidationError {}