1use core::fmt::Display;
2
3pub type Result<T> = core::result::Result<T, Error>;
4
5#[derive(Debug, Clone)]
6pub enum Error {
7 FileSystem(file_system::Error),
8 Task(task::Error),
9 FailedToGetMainFunction,
10 InvalidStackSize,
11 PermissionDenied,
12}
13
14impl Display for Error {
15 fn fmt(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {
16 match self {
17 Error::FileSystem(error) => write!(formatter, "{error}"),
18 Error::Task(error) => write!(formatter, "{error}"),
19 Error::FailedToGetMainFunction => {
20 write!(formatter, "Failed to get main function")
21 }
22 Error::InvalidStackSize => write!(formatter, "Invalid stack size"),
23 Error::PermissionDenied => write!(formatter, "Permission denied"),
24 }
25 }
26}
27
28impl From<file_system::Error> for Error {
29 fn from(error: file_system::Error) -> Self {
30 Error::FileSystem(error)
31 }
32}
33
34impl From<task::Error> for Error {
35 fn from(error: task::Error) -> Self {
36 Error::Task(error)
37 }
38}