tauri_typegen/
error.rs

1use serde::{ser::Serializer, Serialize};
2
3pub type Result<T> = std::result::Result<T, Error>;
4
5#[derive(Debug, thiserror::Error)]
6pub enum Error {
7    #[error(transparent)]
8    Io(#[from] std::io::Error),
9
10    #[error("Command analysis failed: {0}")]
11    CommandAnalysis(String),
12
13    #[error("Code generation failed: {0}")]
14    CodeGeneration(String),
15
16    #[error("Invalid project path: {0}")]
17    InvalidProjectPath(String),
18}
19
20impl Serialize for Error {
21    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22    where
23        S: Serializer,
24    {
25        serializer.serialize_str(self.to_string().as_ref())
26    }
27}