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§
Sourcefn severity(&self) -> ErrorSeverity
fn severity(&self) -> ErrorSeverity
Classifies this error.
Provided Methods§
Sourcefn is_recoverable(&self) -> bool
fn is_recoverable(&self) -> bool
Returns true if the failing operation can be retried without rebuilding.
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
impl MediaError for DecodeError
Source§fn severity(&self) -> ErrorSeverity
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.