vite_rust/
error.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use std::{error::Error, fmt};
use serde::Deserialize;

#[derive(Debug, Deserialize)]
pub enum ViteErrorKind {
    Manifest
}

#[derive(Debug, Deserialize)]
pub struct ViteError {
    cause: String,
    kind: ViteErrorKind
}

impl ViteError {
    pub fn new(cause: String, kind: ViteErrorKind) -> Self {
        ViteError { cause, kind }
    }
}

impl fmt::Display for ViteError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.cause)
    }
}

impl Error for ViteError {}