Skip to main content

FraiseQLError

Enum FraiseQLError 

Source
pub enum FraiseQLError {
Show 14 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, }, 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.

Variants§

§

Parse

GraphQL parsing error.

Returned when the GraphQL query string cannot be parsed.

Fields

§message: String

Error message describing the parse failure.

§location: String

Location in the query where the error occurred.

§

Validation

GraphQL validation error.

Returned when a query is syntactically valid but semantically invalid.

Fields

§message: String

Error message describing the validation failure.

§path: Option<String>

Path to the field with the error (e.g., “user.posts.0.title”).

§

UnknownField

Unknown field error.

Returned when a query references a field that doesn’t exist in the schema.

Fields

§field: String

The field name that was not found.

§type_name: String

The type on which the field was queried.

§

UnknownType

Unknown type error.

Returned when a query references a type that doesn’t exist in the schema.

Fields

§type_name: String

The type name that was not found.

§

Database

Database operation error.

Wraps errors from PostgreSQL operations.

Fields

§message: String

Error message from the database.

§sql_state: Option<String>

SQL state code if available (e.g., “23505” for unique violation).

§

ConnectionPool

Connection pool error.

Returned when the database connection pool is exhausted or unavailable.

Fields

§message: String

Error message.

§

Timeout

Query timeout error.

Returned when a database query exceeds the configured timeout.

Fields

§timeout_ms: u64

Timeout duration in milliseconds.

§query: Option<String>

The query that timed out (truncated if too long).

§

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

§query_id: String

Query identifier for tracking/logging.

§reason: String

Reason for cancellation (e.g., “user cancelled”, “connection closed”).

§

Authorization

Authorization error.

Returned when the user doesn’t have permission for an operation.

Fields

§message: String

Error message.

§action: Option<String>

The action that was denied (e.g., “read”, “write”, “delete”).

§resource: Option<String>

The resource that was being accessed.

§

Authentication

Authentication error.

Returned when authentication fails (invalid token, expired, etc.).

Fields

§message: String

Error message.

§

NotFound

Resource not found error.

Returned when a requested resource doesn’t exist.

Fields

§resource_type: String

Type of resource (e.g., “User”, “Post”).

§identifier: String

Identifier that was looked up.

§

Conflict

Conflict error.

Returned when an operation would conflict with existing data.

Fields

§message: String

Error message.

§

Configuration

Configuration error.

Returned when configuration is invalid or missing.

Fields

§message: String

Error message.

§

Internal

Internal error.

Returned for unexpected internal errors. Should be rare.

Fields

§message: String

Error message.

§source: Option<Box<dyn Error + Send + Sync>>

Optional source error for debugging.

Implementations§

Source§

impl FraiseQLError

Source

pub fn parse(message: impl Into<String>) -> Self

Create a parse error.

Source

pub fn parse_at(message: impl Into<String>, location: impl Into<String>) -> Self

Create a parse error with location.

Source

pub fn validation(message: impl Into<String>) -> Self

Create a validation error.

Source

pub fn validation_at( message: impl Into<String>, path: impl Into<String>, ) -> Self

Create a validation error with path.

Source

pub fn database(message: impl Into<String>) -> Self

Create a database error.

Source

pub fn unauthorized(message: impl Into<String>) -> Self

Create an authorization error.

Source

pub fn not_found( resource_type: impl Into<String>, identifier: impl Into<String>, ) -> Self

Create a not found error.

Source

pub fn config(message: impl Into<String>) -> Self

Create a configuration error.

Source

pub fn internal(message: impl Into<String>) -> Self

Create an internal error.

Source

pub fn cancelled(query_id: impl Into<String>, reason: impl Into<String>) -> Self

Create a cancellation error.

Source

pub const fn is_client_error(&self) -> bool

Check if this is a client error (4xx equivalent).

Source

pub const fn is_server_error(&self) -> bool

Check if this is a server error (5xx equivalent).

Source

pub const fn is_retryable(&self) -> bool

Check if this error is retryable.

Source

pub const fn status_code(&self) -> u16

Get HTTP status code equivalent.

Source

pub const fn error_code(&self) -> &'static str

Get error code for GraphQL response.

Trait Implementations§

Source§

impl Debug for FraiseQLError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for FraiseQLError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for FraiseQLError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Error> for FraiseQLError

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for FraiseQLError

Source§

fn from(e: Error) -> Self

Converts to this type from the input type.
Source§

impl From<VarError> for FraiseQLError

Source§

fn from(e: VarError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more