supabase_rust/error.rs
1/// Unified error type for all supabase-rust operations.
2#[derive(Debug, thiserror::Error)]
3pub enum Error {
4 /// Missing or empty configuration value (URL or API key).
5 #[error("configuration error: {0}")]
6 Config(String),
7
8 /// HTTP transport failure.
9 #[error(transparent)]
10 Request(#[from] reqwest::Error),
11
12 /// JSON serialization or deserialization failure.
13 #[error(transparent)]
14 Serialization(#[from] serde_json::Error),
15
16 /// JWT validation failure.
17 #[error(transparent)]
18 Jwt(#[from] jsonwebtoken::errors::Error),
19
20 /// An authenticated operation was attempted without a bearer token.
21 #[error("authentication required: {0}")]
22 AuthRequired(String),
23
24 /// The Supabase API returned a non-2xx response.
25 #[error("API error {status}: {message}")]
26 Api {
27 /// HTTP status code.
28 status: u16,
29 /// Error message from the response body.
30 message: String,
31 },
32}