pub struct Error(/* private fields */);Expand description
An error, carrying a code, a message and optionally where in the query it happened.
The payload is boxed so that Error is one pointer wide, which keeps Result<T> the same size
as T for every T that has a niche. Errors are rare and results are returned from every
function in the workspace, so the cost belongs on the rare path.
Implementations§
Source§impl Error
impl Error
Sourcepub fn new(code: ErrorCode, message: impl Into<String>) -> Self
pub fn new(code: ErrorCode, message: impl Into<String>) -> Self
An error with a code and a message and no span.
Sourcepub fn with_span(self, span: Span) -> Self
pub fn with_span(self, span: Span) -> Self
The same error, with the part of the query it is about.
Sourcepub fn span(&self) -> Option<Span>
pub fn span(&self) -> Option<Span>
Where in the query text this is about, if it is about a place.
Sourcepub fn syntax(message: impl Into<String>) -> Self
pub fn syntax(message: impl Into<String>) -> Self
The text is SQL and a value in it is not one the statement can take.
Sourcepub fn binder(message: impl Into<String>) -> Self
pub fn binder(message: impl Into<String>) -> Self
The text is SQL and it does not mean anything.
Sourcepub fn catalog(message: impl Into<String>) -> Self
pub fn catalog(message: impl Into<String>) -> Self
A named object is missing, or one that should be missing is not.
Sourcepub fn conversion(message: impl Into<String>) -> Self
pub fn conversion(message: impl Into<String>) -> Self
A value will not convert to the type it is being asked for.
Sourcepub fn out_of_range(message: impl Into<String>) -> Self
pub fn out_of_range(message: impl Into<String>) -> Self
A value is outside what its type can hold.
Sourcepub fn invalid_input(message: impl Into<String>) -> Self
pub fn invalid_input(message: impl Into<String>) -> Self
An argument is wrong in a way that is not a type error.
Sourcepub fn out_of_memory(message: impl Into<String>) -> Self
pub fn out_of_memory(message: impl Into<String>) -> Self
An allocation failed or a memory limit was reached.
Sourcepub fn io(message: impl Into<String>) -> Self
pub fn io(message: impl Into<String>) -> Self
The filesystem, the network or the object store said no.
Sourcepub fn not_implemented(message: impl Into<String>) -> Self
pub fn not_implemented(message: impl Into<String>) -> Self
It is in the plan and it is not built yet.
Sourcepub fn constraint(message: impl Into<String>) -> Self
pub fn constraint(message: impl Into<String>) -> Self
A constraint was violated.
Sourcepub fn transaction(message: impl Into<String>) -> Self
pub fn transaction(message: impl Into<String>) -> Self
A conflict, an abort, or a statement issued outside a transaction that needs one.
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
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()