1use std::io;
11use thiserror::Error;
12
13#[derive(Debug, Error)]
14pub enum Error {
15 #[error("IO error reading file: {0}")]
16 IOError(io::Error),
17 #[error("Error reading riff file: {0}")]
18 RiffError(riff_wave_reader::Error),
19 #[error("No extended info in riff file, can't determine spec")]
20 RiffErrorNoExtendedInfo,
21 #[error("File supplied is not Atrac3Plus")]
22 NotAtrac3PlusFile,
23 #[error("Block align is not set")]
24 BlockAlignNotSet,
25 #[error("Invalid Start Bit")]
26 InvalidStartBit,
27 #[error("Unsupported channel unit extension")]
28 UnsupportedChannelUnitExtension,
29 #[error("Channel Unit Type can only be 2 bits")]
30 InvalidChannelUnitTypeBits,
31 #[error("Invalid Data")]
32 InvalidData,
33 #[error("Unsupported channel count: {0}")]
34 UnsupportedChannelCount(u16),
35 #[error("{0}")]
36 Other(&'static str),
37 #[error("{0}")]
38 OtherFormat(String),
39}
40
41impl From<riff_wave_reader::Error> for Error {
42 fn from(error: riff_wave_reader::Error) -> Self {
43 Error::RiffError(error)
44 }
45}
46
47impl From<std::io::Error> for Error {
48 fn from(error: std::io::Error) -> Self {
49 Error::IOError(error)
50 }
51}