tauri_plugin_shell/
error.rs1use std::path::PathBuf;
6
7use serde::{Serialize, Serializer};
8
9#[derive(Debug, thiserror::Error)]
11pub enum Error {
12 #[error(transparent)]
13 Io(#[from] std::io::Error),
14 #[error("current executable path has no parent")]
17 CurrentExeHasNoParent,
18 #[error(transparent)]
19 Scope(#[from] crate::scope::Error),
20 #[error("sidecar not configured under `tauri.conf.json > bundle > externalBin`: {0}")]
22 SidecarNotAllowed(PathBuf),
23 #[error("program not allowed on the configured shell scope: {0}")]
25 ProgramNotAllowed(PathBuf),
26 #[error("unknown encoding {0}")]
28 UnknownEncoding(String),
29 #[error(transparent)]
31 Json(#[from] serde_json::Error),
32 #[error(transparent)]
34 Utf8(#[from] std::string::FromUtf8Error),
35}
36
37impl Serialize for Error {
38 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
39 where
40 S: Serializer,
41 {
42 serializer.serialize_str(self.to_string().as_ref())
43 }
44}