Skip to main content

MediaError

Trait MediaError 

Source
pub trait MediaError {
    // Required method
    fn severity(&self) -> ErrorSeverity;

    // Provided methods
    fn is_recoverable(&self) -> bool { ... }
    fn is_fatal(&self) -> bool { ... }
}
Expand description

Shared classification for the ff-* crate error types.

Implement severity on each error type; the boolean helpers are derived from it. This lets downstream code branch on recoverability generically:

use ff_format::{FormatError, MediaError, ErrorSeverity};

let err = FormatError::invalid_pixel_format("nope");
assert_eq!(err.severity(), ErrorSeverity::Other);
assert!(!err.is_recoverable());
assert!(!err.is_fatal());

Required Methods§

Source

fn severity(&self) -> ErrorSeverity

Classifies this error.

Provided Methods§

Source

fn is_recoverable(&self) -> bool

Returns true if the failing operation can be retried without rebuilding.

Source

fn is_fatal(&self) -> bool

Returns true if the component must be discarded or reconfigured.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl MediaError for DecodeError

Source§

fn severity(&self) -> ErrorSeverity

Recoverable errors are retryable without rebuilding the decoder (a corrupt frame, a transient network fault); fatal errors mean it must be discarded.

Source§

impl MediaError for PreviewError

Source§

impl MediaError for ProbeError

Implementors§