pub struct Error { /* private fields */ }Implementations§
Source§impl Error
impl Error
Sourcepub fn new(state: SqlState, message: impl Into<String>) -> Error
pub fn new(state: SqlState, message: impl Into<String>) -> Error
An error with a SQLSTATE and a primary message.
Sourcepub fn corrupted(message: impl Into<String>) -> Error
pub fn corrupted(message: impl Into<String>) -> Error
An XX001 error. A check found damaged data.
Sourcepub fn internal(message: impl Into<String>) -> Error
pub fn internal(message: impl Into<String>) -> Error
An XX000 error. rupg found a state that its own rules do not allow.
Sourcepub fn with_detail(self, detail: impl Into<String>) -> Error
pub fn with_detail(self, detail: impl Into<String>) -> Error
Adds the detail line.
Sourcepub fn at(self, location: usize) -> Error
pub fn at(self, location: usize) -> Error
Adds the place in the query text where the error starts, as a byte offset. The session gives it to the client as a character position in the field P. An error that has a place keeps it.
Sourcepub fn with_position(self, location: Option<usize>) -> Error
pub fn with_position(self, location: Option<usize>) -> Error
Sets the place in the query text and drops the place that the error has, as parser_errposition in an error context callback does. None drops the place.
Sourcepub fn with_context(self, line: impl Into<String>) -> Error
pub fn with_context(self, line: impl Into<String>) -> Error
Adds a line to the context, as errcontext does in an error context callback. The lines go from the inner place to the outer place.
Sourcepub fn as_notice(self) -> Error
pub fn as_notice(self) -> Error
Marks a message for the client as a NOTICE, as ereport(NOTICE) with a SQLSTATE such as 54000 makes it. A message without the mark is a NOTICE only for a SQLSTATE of class 00.
Sourcepub fn is_notice(&self) -> bool
pub fn is_notice(&self) -> bool
True for a message that Error::as_notice marked.
Sourcepub fn with_level(self, level: Level) -> Error
pub fn with_level(self, level: Level) -> Error
Sets the level of a message that is not an error, as ereport with a level such as INFO gives it.
Sourcepub fn level(&self) -> Option<Level>
pub fn level(&self) -> Option<Level>
The level that Error::with_level set, if any.
Sourcepub fn with_internal(
self,
query: impl Into<String>,
position: Option<usize>,
) -> Error
pub fn with_internal( self, query: impl Into<String>, position: Option<usize>, ) -> Error
Sets the internal query and the byte offset in it where the error starts, as internalerrquery and internalerrposition do. The session gives them to the client in the fields q and p.
Sourcepub fn internal_query(&self) -> Option<(&str, Option<usize>)>
pub fn internal_query(&self) -> Option<(&str, Option<usize>)>
The internal query and the byte offset in it, if any.
Sourcepub fn with_object(self, object: Object, name: impl Into<String>) -> Error
pub fn with_object(self, object: Object, name: impl Into<String>) -> Error
Sets a name of the object of the error, such as the table of a constraint that the error violates.
Sourcepub fn object(&self, object: Object) -> Option<&str>
pub fn object(&self, object: Object) -> Option<&str>
The name that Error::with_object set, if any.
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()