1use core::fmt;
2
3
4pub type ApiError = sys::error::Error<self::Error>;
5
6
7#[derive(Debug)]
8pub enum Error {
9 FileNotExist,
11
12 Alloc,
14
15 Fs(fs::error::Error),
17}
18
19impl fmt::Display for Error {
20 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
21 match &self {
22 Error::Alloc => write!(f, "Snd: Allocation failed"),
23 Error::FileNotExist => write!(f, "Snd: File doesn't exist"),
24 Error::Fs(err) => err.fmt(f),
25 }
26 }
27}
28
29
30impl Into<ApiError> for Error {
31 fn into(self) -> ApiError { ApiError::Api(self) }
32}
33
34impl From<fs::error::Error> for Error {
35 fn from(err: fs::error::Error) -> Self { Self::Fs(err) }
36}
37
38
39impl core::error::Error for Error {}