azathoth_core/errors.rs
1/// Generic Error enums
2#[derive(Copy, Clone, Eq, PartialEq, Debug)]
3#[repr(u8)]
4pub enum ErrorClass {
5 Unspecified = 0,
6 Core = 1,
7 Alloc = 2,
8 Os = 3,
9 Dynload = 4,
10 Io = 5,
11 Other = 255
12}
13
14/// Trait that helps with making sure all errors use the same format
15pub trait AzError: Copy + Eq + core::fmt::Display {
16 const CLASS: ErrorClass;
17
18 fn code(&self) -> u16;
19 fn os_code(&self) -> Option<u32> { None }
20 fn is_retryable(&self) -> bool { false }
21}