pub struct ScytheError {
pub code: ErrorCode,
pub message: String,
}Fields§
§code: ErrorCode§message: StringImplementations§
Source§impl ScytheError
impl ScytheError
pub fn new(code: ErrorCode, message: impl Into<String>) -> Self
pub fn syntax(msg: impl Into<String>) -> Self
pub fn unknown_table(name: &str) -> Self
pub fn unknown_column(name: &str) -> Self
pub fn unknown_function(name: &str) -> Self
pub fn ambiguous_function(name: &str) -> Self
pub fn ambiguous_column(name: &str) -> Self
pub fn type_mismatch(msg: impl Into<String>) -> Self
pub fn missing_annotation(what: &str) -> Self
pub fn invalid_annotation(msg: impl Into<String>) -> Self
pub fn column_count_mismatch(left: usize, right: usize) -> Self
pub fn duplicate_alias(name: &str) -> Self
Sourcepub fn cte_column_alias_mismatch(
alias_count: usize,
column_count: usize,
) -> Self
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.
pub fn invalid_recursion(msg: impl Into<String>) -> Self
Sourcepub fn invalid_config(msg: impl Into<String>) -> Self
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.
Sourcepub fn untypeable_record(subject: &str, column: &str, function: &str) -> Self
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.
Sourcepub fn untypeable_row_constructor(subject: &str, column: &str) -> Self
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).
Sourcepub fn unresolved_expression_type(subject: &str, column: &str) -> Self
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
impl Debug for ScytheError
Source§impl Display for ScytheError
impl Display for ScytheError
Source§impl Error for ScytheError
impl Error for ScytheError
1.30.0 · 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
use the Display impl or to_string()