tauri_plugin_profiling/
error.rs1use serde::{Serialize, Serializer};
4use thiserror::Error;
5
6#[derive(Debug, Error)]
8pub enum Error {
9 #[error("Profiling is not supported on this platform")]
10 UnsupportedPlatform,
11
12 #[error("Profiler is already running")]
13 AlreadyRunning,
14
15 #[error("No profiler is currently running")]
16 NotRunning,
17
18 #[error("Failed to start profiler: {0}")]
19 StartFailed(String),
20
21 #[error("Failed to build profiler report: {0}")]
22 ReportFailed(String),
23
24 #[error("Failed to generate flamegraph: {0}")]
25 FlamegraphFailed(String),
26
27 #[error("I/O error: {0}")]
28 Io(#[from] std::io::Error),
29
30 #[error("Failed to resolve output path: {0}")]
31 PathResolution(String),
32
33 #[error("Tauri error: {0}")]
34 Tauri(#[from] tauri::Error),
35
36 #[error("Lock poisoned")]
37 LockPoisoned,
38}
39
40impl Serialize for Error {
41 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
42 where
43 S: Serializer,
44 {
45 serializer.serialize_str(&self.to_string())
46 }
47}
48
49pub type Result<T> = std::result::Result<T, Error>;