Skip to main content

Error

Enum Error 

Source
pub enum Error {
Show 14 variants Db(Error), Compile(PyQLError), Decode(DecodeError), MissingParam(String), InvalidArgument(String), ResultCardinality { got: usize, }, NoData, NoSchemaSnapshot, SchemaJson(Error), Analyze(String), Cache(String), UnknownChannel(String), MalformedPayload(String), Rollback,
}

Variants§

§

Db(Error)

A connection/pool/decode/server-response failure from the driver.

§

Compile(PyQLError)

PyQL failed to compile — a syntax/type/resolution/cardinality error.

§

Decode(DecodeError)

A row didn’t fit the type query::<R, _> was asked to decode it into — a shape missing a field the struct declares, an enum label with no matching variant, an integer too wide for its Rust type.

§

MissingParam(String)

A required query parameter (named or __global__-prefixed) had no matching entry in the params/globals passed by the caller.

§

InvalidArgument(String)

An argument the query cannot mean — today only a NULL inside an array, which PyQL has no type for. Carries the wording verbatim so every client reports it the same way.

§

ResultCardinality

query_single/query_required_single (and their _json siblings) got more than one row back.

Fields

§got: usize
§

NoData

query_required_single (and its _json sibling) got zero rows.

§

NoSchemaSnapshot

Neither pylon migration apply nor pylon migration watch has ever run against this database, so there’s no schema snapshot to load — a bare schema-file edit has no effect until one of those does.

§

SchemaJson(Error)

§

Analyze(String)

EXPLAIN’s raw JSON output failed to correlate against the query’s own analyze_paths (pylon_core::analyze::build_coarse_grained).

§

Cache(String)

A pylon_cache::Cache open/get/put failure — that crate’s own errors are a boxed dyn Error + Send + Sync, not a good match for thiserror’s #[from]/transparent, so this just carries the rendered message.

§

UnknownChannel(String)

Client::listen(name) — no Channel declared in the schema matches name (bare or module::name).

§

MalformedPayload(String)

A Client::listen() NOTIFY payload didn’t match its Channel’s own declared shape (bad JSON, a value that doesn’t parse as its declared scalar type, a missing Object field, …).

§

Rollback

Not a failure: a transaction body asking to be rolled back instead of committed. The Rust counterpart of pylon.Rollback — a body that wants to write, read its own writes and then leave nothing behind (a test, a dry run) returns this. It rides in Error because the body’s return type is Result<T> and there is no T to hand back on a path that deliberately produced nothing; [Client::transaction_opt] turns it into Ok(None) for callers who would rather not see an error at all.

Implementations§

Source§

impl Error

Source

pub fn sqlstate(&self) -> Option<&SqlState>

The Postgres SQLSTATE code, when this wraps a real server response — None for a compile error or a connection/pool/decode failure.

Source

pub fn is_serialization_error(&self) -> bool

40001 — a serializable/repeatable-read transaction lost a write skew race. Retriable by re-running the whole transaction body.

Source

pub fn is_deadlock(&self) -> bool

40P01 — Postgres broke a deadlock by aborting this transaction. Retriable the same way a serialization failure is.

Source

pub fn is_retriable(&self) -> bool

Either of the two conditions the retrying transaction loop (transaction.rs) automatically retries on.

Source

pub fn is_rollback(&self) -> bool

A deliberate abort (Error::Rollback) rather than a failure — worth distinguishing when a caller drives Client::transaction_with_attempts directly instead of going through Client::transaction_opt.

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

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<DecodeError> for Error

Source§

fn from(source: DecodeError) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for Error

Source§

fn from(source: Error) -> Self

Converts to this type from the input type.
Source§

impl From<PyQLError> for Error

Source§

fn from(source: PyQLError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Freeze for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

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> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<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