1use serde::Deserialize;
2use std::{error::Error, fmt};
3
4#[derive(Debug, Deserialize)]
5pub enum ViteErrorKind {
6 Manifest,
7}
8
9#[derive(Debug, Deserialize)]
10#[allow(unused)]
11pub struct ViteError {
12 cause: Box<str>,
13 kind: ViteErrorKind,
14}
15
16impl ViteError {
17 pub fn new<T>(cause: T, kind: ViteErrorKind) -> Self
18 where
19 T: ToString,
20 {
21 ViteError {
22 cause: cause.to_string().into_boxed_str(),
23 kind,
24 }
25 }
26}
27
28impl fmt::Display for ViteError {
29 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
30 write!(f, "{}", self.cause)
31 }
32}
33
34impl Error for ViteError {}