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
44
45
//! Unified error type for the opticaldiscs library.
use thiserror::Error;
/// All errors that can be produced by this library.
#[derive(Debug, Error)]
pub enum OpticaldiscsError {
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Parse error: {0}")]
Parse(String),
#[error("Unsupported format: {0}")]
UnsupportedFormat(String),
#[error("Unsupported filesystem")]
UnsupportedFilesystem,
#[error("Entry not found: {0}")]
NotFound(String),
#[error("Not a directory: {0}")]
NotADirectory(String),
#[error("Invalid data: {0}")]
InvalidData(String),
#[error("CHD error: {0}")]
Chd(String),
#[error("CUE error: {0}")]
Cue(String),
/// A container's track table holds no data track.
///
/// Not raised for BIN/CUE, CloneCD or CHD: a pure CD-DA disc has no data
/// track by definition, so those open as
/// [`FilesystemType::None`](crate::FilesystemType::None) instead. See
/// [`DiscImageInfo::is_audio_only`](crate::detect::DiscImageInfo::is_audio_only).
#[error("No data track found")]
NoDataTrack,
}
pub type Result<T> = std::result::Result<T, OpticaldiscsError>;