Skip to main content

oximedia_edit/
error.rs

1//! Error types for the timeline editor.
2
3#![allow(missing_docs)]
4
5use oximedia_core::OxiError;
6
7/// Result type for timeline editing operations.
8pub type EditResult<T> = Result<T, EditError>;
9
10/// Errors that can occur during timeline editing.
11#[derive(Debug, thiserror::Error)]
12pub enum EditError {
13    /// Track index out of bounds.
14    #[error("Track index {0} out of bounds (total tracks: {1})")]
15    InvalidTrackIndex(usize, usize),
16
17    /// Clip not found.
18    #[error("Clip with ID {0} not found")]
19    ClipNotFound(u64),
20
21    /// Invalid time range.
22    #[error("Invalid time range: {start} to {end}")]
23    InvalidTimeRange { start: i64, end: i64 },
24
25    /// Invalid transition parameters.
26    #[error("Invalid transition: {0}")]
27    InvalidTransition(String),
28
29    /// Clip overlap detected.
30    #[error("Clip overlap at time {0} on track {1}")]
31    ClipOverlap(i64, usize),
32
33    /// Clip type does not match the track type.
34    #[error("Track type mismatch: track expects {expected:?} clip but got {got:?}")]
35    TrackTypeMismatch {
36        /// The clip type the track accepts.
37        expected: crate::clip::ClipType,
38        /// The clip type that was provided.
39        got: crate::clip::ClipType,
40    },
41
42    /// Invalid edit operation.
43    #[error("Invalid edit operation: {0}")]
44    InvalidEdit(String),
45
46    /// Invalid operation (e.g., unsupported format or capability).
47    #[error("Invalid operation: {0}")]
48    InvalidOperation(String),
49
50    /// Keyframe error.
51    #[error("Keyframe error: {0}")]
52    KeyframeError(String),
53
54    /// Render error.
55    #[error("Render error: {0}")]
56    RenderError(String),
57
58    /// Codec error.
59    #[error("Codec error: {0}")]
60    CodecError(#[from] OxiError),
61
62    /// I/O error.
63    #[error("I/O error: {0}")]
64    IoError(#[from] std::io::Error),
65
66    /// Graph error.
67    #[error("Filter graph error: {0}")]
68    GraphError(#[from] oximedia_graph::GraphError),
69}