Skip to main content

commit_wizard/engine/error/
kind.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
4#[serde(rename_all = "kebab-case")]
5pub enum ErrorKind {
6    User,
7    Config,
8    State,
9    Registry,
10    Git,
11    Validation,
12    Release,
13    Hook,
14    Ai,
15    Io,
16    Process,
17    Runtime,
18}
19
20impl ErrorKind {
21    pub const fn prefix(self) -> u16 {
22        match self {
23            Self::User => 0,
24            Self::Config => 1,
25            Self::State => 2,
26            Self::Registry => 3,
27            Self::Git => 4,
28            Self::Validation => 5,
29            Self::Release => 6,
30            Self::Hook => 7,
31            Self::Ai => 8,
32            Self::Io => 9,
33            Self::Process => 10,
34            Self::Runtime => 11,
35        }
36    }
37}