1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! Error constructors for text encoding failures
//!
//! Provides helpers that build structured `CoreError` values for UTF-8 and
//! generic text validation failures, attaching position and context details.
use CoreError;
use ;
use fmt;
/// Create UTF-8 encoding error with position information
///
/// Generates a `CoreError::Utf8Error` with detailed position and context
/// information about the encoding failure.
///
/// # Arguments
///
/// * `position` - Byte position where the error occurred
/// * `message` - Descriptive error message
///
/// # Examples
///
/// ```rust
/// use ass_core::utils::errors::{utf8_error, CoreError};
///
/// let error = utf8_error(42, "Invalid UTF-8 sequence".to_string());
/// assert!(matches!(error, CoreError::Utf8Error { .. }));
/// ```
pub const
/// Create validation error for text content
///
/// Generates a `CoreError::Validation` for content that fails ASS-specific
/// text validation rules (e.g., contains invalid control characters).
///
/// # Arguments
///
/// * `message` - Description of the validation failure