Skip to main content

ScytheError

Struct ScytheError 

Source
pub struct ScytheError {
    pub code: ErrorCode,
    pub message: String,
}

Fields§

§code: ErrorCode§message: String

Implementations§

Source§

impl ScytheError

Source

pub fn new(code: ErrorCode, message: impl Into<String>) -> Self

Source

pub fn syntax(msg: impl Into<String>) -> Self

Source

pub fn unknown_table(name: &str) -> Self

Source

pub fn unknown_column(name: &str) -> Self

Source

pub fn unknown_function(name: &str) -> Self

Source

pub fn ambiguous_function(name: &str) -> Self

Source

pub fn ambiguous_column(name: &str) -> Self

Source

pub fn type_mismatch(msg: impl Into<String>) -> Self

Source

pub fn missing_annotation(what: &str) -> Self

Source

pub fn invalid_annotation(msg: impl Into<String>) -> Self

Source

pub fn column_count_mismatch(left: usize, right: usize) -> Self

Source

pub fn duplicate_alias(name: &str) -> Self

Source

pub fn cte_column_alias_mismatch( alias_count: usize, column_count: usize, ) -> Self

The explicit column alias list on a CTE (WITH t(a, b) AS ...) has a different entry count than the CTE body’s output columns. PostgreSQL rejects this at parse/plan time, so scythe must too — silently matching by position would mislabel columns.

Source

pub fn invalid_recursion(msg: impl Into<String>) -> Self

Source

pub fn invalid_config(msg: impl Into<String>) -> Self

Build an error for user-supplied configuration that scythe understood well enough to reject — a misspelled option key, an out-of-range value.

Prefer this over ScytheError::new with ErrorCode::InternalError anywhere the offending input came from scythe.toml rather than from scythe’s own state.

Source

pub fn untypeable_record(subject: &str, column: &str, function: &str) -> Self

A set-returning function’s anonymous record column referenced in select-list position – json_each/jsonb_each/json_each_text/ jsonb_each_text and the json_populate_record/jsonb_populate_record/ json_populate_recordset/jsonb_populate_recordset family. PostgreSQL’s record pseudo-type has no neutral-type representation, but every one of these functions has a FROM-clause form that expands into real, typeable columns instead (#223).

The message deliberately does not hardcode .key/.value as the worked example: that’s the right rewrite for the json_each/ json_each_text family (see testing_data/types/json_jsonb_advanced/06_jsonb_each_from.json) but wrong for json_populate_record, whose columns come from a caller-supplied row type instead – one message covering both families has to stay generic about the field names.

Source

pub fn untypeable_row_constructor(subject: &str, column: &str) -> Self

A multi-element ROW(...)/tuple constructor – (a, b) (parses as Expr::Tuple) or the explicit ROW(a, b) call (parses as a function named row) – neither of which has a single neutral type (#117, #223).

Source

pub fn unresolved_expression_type(subject: &str, column: &str) -> Self

A generic fallback for any other expression infer_expr_type cannot resolve to a type: an unresolved composite field access, unnest over a non-array argument, a subquery producing no columns, a table-valued function scythe has no column-type mapping for, and the handful of AST shapes with no dedicated inference arm (#223).

Trait Implementations§

Source§

impl Debug for ScytheError

Source§

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

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

impl Display for ScytheError

Source§

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

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

impl Error for ScytheError

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

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.