tauri_plugin_posthog/
error.rs1use 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 #[error("PostHog client error: {0}")]
10 PostHogClient(posthog_rs::Error),
11 #[error("Client options error: {0}")]
12 ClientOptions(String),
13 #[error("Timestamp parse error: {0}")]
14 TimestampParse(String),
15 #[error("Missing API key: Please set POSTHOG_API_KEY environment variable or configure apiKey in tauri.conf.json")]
16 MissingApiKey,
17}
18
19impl Serialize for Error {
20 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21 where
22 S: Serializer,
23 {
24 serializer.serialize_str(self.to_string().as_ref())
25 }
26}