#[non_exhaustive]pub enum FraiseQLError {
Show 15 variants
Parse {
message: String,
location: String,
},
Validation {
message: String,
path: Option<String>,
},
UnknownField {
field: String,
type_name: String,
},
UnknownType {
type_name: String,
},
Database {
message: String,
sql_state: Option<String>,
},
ConnectionPool {
message: String,
},
Timeout {
timeout_ms: u64,
query: Option<String>,
},
Cancelled {
query_id: String,
reason: String,
},
Authorization {
message: String,
action: Option<String>,
resource: Option<String>,
},
Authentication {
message: String,
},
RateLimited {
message: String,
retry_after_secs: u64,
},
NotFound {
resource_type: String,
identifier: String,
},
Conflict {
message: String,
},
Configuration {
message: String,
},
Internal {
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
}Expand description
Main error type for FraiseQL operations.
All errors in the core library are converted to this type. Language bindings convert this to their native error types.
§Stability
This enum is marked #[non_exhaustive] to allow adding new error variants
in future minor versions without breaking backward compatibility.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Parse
GraphQL parsing error.
Returned when the GraphQL query string cannot be parsed.
Fields
Validation
GraphQL validation error.
Returned when a query is syntactically valid but semantically invalid.
Fields
UnknownField
Unknown field error.
Returned when a query references a field that doesn’t exist in the schema.
Fields
UnknownType
Unknown type error.
Returned when a query references a type that doesn’t exist in the schema.
Database
Database operation error.
Wraps errors from PostgreSQL operations.
Fields
ConnectionPool
Connection pool error.
Returned when the database connection pool is exhausted or unavailable.
Timeout
Query timeout error.
Returned when a database query exceeds the configured timeout.
Fields
Cancelled
Query cancellation error.
Returned when a query execution is cancelled via a cancellation token or similar mechanism (e.g., client disconnection, explicit user request).
Fields
Authorization
Authorization error.
Returned when the user doesn’t have permission for an operation.
Fields
Authentication
Authentication error.
Returned when authentication fails (invalid token, expired, etc.).
RateLimited
Rate limiting error.
Returned when a request is rate limited due to too many errors.
Fields
NotFound
Resource not found error.
Returned when a requested resource doesn’t exist.
Fields
Conflict
Conflict error.
Returned when an operation would conflict with existing data.
Configuration
Configuration error.
Returned when configuration is invalid or missing.
Internal
Internal error.
Returned for unexpected internal errors. Should be rare.
Implementations§
Source§impl FraiseQLError
impl FraiseQLError
Sourcepub fn parse_at(message: impl Into<String>, location: impl Into<String>) -> Self
pub fn parse_at(message: impl Into<String>, location: impl Into<String>) -> Self
Create a parse error with location.
Sourcepub fn validation(message: impl Into<String>) -> Self
pub fn validation(message: impl Into<String>) -> Self
Create a validation error.
Sourcepub fn validation_at(
message: impl Into<String>,
path: impl Into<String>,
) -> Self
pub fn validation_at( message: impl Into<String>, path: impl Into<String>, ) -> Self
Create a validation error with path.
Create an authorization error.
Sourcepub fn not_found(
resource_type: impl Into<String>,
identifier: impl Into<String>,
) -> Self
pub fn not_found( resource_type: impl Into<String>, identifier: impl Into<String>, ) -> Self
Create a not found error.
Sourcepub fn cancelled(query_id: impl Into<String>, reason: impl Into<String>) -> Self
pub fn cancelled(query_id: impl Into<String>, reason: impl Into<String>) -> Self
Create a cancellation error.
Sourcepub const fn is_client_error(&self) -> bool
pub const fn is_client_error(&self) -> bool
Check if this is a client error (4xx equivalent).
Sourcepub const fn is_server_error(&self) -> bool
pub const fn is_server_error(&self) -> bool
Check if this is a server error (5xx equivalent).
Sourcepub const fn is_retryable(&self) -> bool
pub const fn is_retryable(&self) -> bool
Check if this error is retryable.
Sourcepub const fn status_code(&self) -> u16
pub const fn status_code(&self) -> u16
Get HTTP status code equivalent.
Sourcepub const fn error_code(&self) -> &'static str
pub const fn error_code(&self) -> &'static str
Get error code for GraphQL response.
Trait Implementations§
Source§impl Debug for FraiseQLError
impl Debug for FraiseQLError
Source§impl Display for FraiseQLError
impl Display for FraiseQLError
Source§impl Error for FraiseQLError
impl Error for FraiseQLError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<Error> for FraiseQLError
impl From<Error> for FraiseQLError
Source§impl From<Error> for FraiseQLError
impl From<Error> for FraiseQLError
Auto Trait Implementations§
impl Freeze for FraiseQLError
impl !RefUnwindSafe for FraiseQLError
impl Send for FraiseQLError
impl Sync for FraiseQLError
impl Unpin for FraiseQLError
impl UnsafeUnpin for FraiseQLError
impl !UnwindSafe for FraiseQLError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.