Struct tokio_postgres::error::DbError
source · pub struct DbError { /* private fields */ }
Expand description
A Postgres error or notice.
Implementations§
source§impl DbError
impl DbError
sourcepub fn parse(fields: &mut ErrorFields<'_>) -> Result<DbError>
pub fn parse(fields: &mut ErrorFields<'_>) -> Result<DbError>
Parses the error fields obtained from Postgres into a DBError
.
sourcepub fn severity(&self) -> &str
pub fn severity(&self) -> &str
The field contents are ERROR, FATAL, or PANIC (in an error message), or WARNING, NOTICE, DEBUG, INFO, or LOG (in a notice message), or a localized translation of one of these.
sourcepub fn parsed_severity(&self) -> Option<Severity>
pub fn parsed_severity(&self) -> Option<Severity>
A parsed, nonlocalized version of severity
. (PostgreSQL 9.6+)
sourcepub fn message(&self) -> &str
pub fn message(&self) -> &str
The primary human-readable error message.
This should be accurate but terse (typically one line).
sourcepub fn detail(&self) -> Option<&str>
pub fn detail(&self) -> Option<&str>
An optional secondary error message carrying more detail about the problem.
Might run to multiple lines.
sourcepub fn hint(&self) -> Option<&str>
pub fn hint(&self) -> Option<&str>
An optional suggestion what to do about the problem.
This is intended to differ from detail
in that it offers advice
(potentially inappropriate) rather than hard facts. Might run to
multiple lines.
sourcepub fn position(&self) -> Option<&ErrorPosition>
pub fn position(&self) -> Option<&ErrorPosition>
An optional error cursor position into either the original query string or an internally generated query.
sourcepub fn where_(&self) -> Option<&str>
pub fn where_(&self) -> Option<&str>
An indication of the context in which the error occurred.
Presently this includes a call stack traceback of active procedural language functions and internally-generated queries. The trace is one entry per line, most recent first.
sourcepub fn schema(&self) -> Option<&str>
pub fn schema(&self) -> Option<&str>
If the error was associated with a specific database object, the name of the schema containing that object, if any. (PostgreSQL 9.3+)
sourcepub fn table(&self) -> Option<&str>
pub fn table(&self) -> Option<&str>
If the error was associated with a specific table, the name of the table. (Refer to the schema name field for the name of the table’s schema.) (PostgreSQL 9.3+)
sourcepub fn column(&self) -> Option<&str>
pub fn column(&self) -> Option<&str>
If the error was associated with a specific table column, the name of the column.
(Refer to the schema and table name fields to identify the table.) (PostgreSQL 9.3+)
sourcepub fn datatype(&self) -> Option<&str>
pub fn datatype(&self) -> Option<&str>
If the error was associated with a specific data type, the name of the data type. (Refer to the schema name field for the name of the data type’s schema.) (PostgreSQL 9.3+)
sourcepub fn constraint(&self) -> Option<&str>
pub fn constraint(&self) -> Option<&str>
If the error was associated with a specific constraint, the name of the constraint.
Refer to fields listed above for the associated table or domain. (For this purpose, indexes are treated as constraints, even if they weren’t created with constraint syntax.) (PostgreSQL 9.3+)
sourcepub fn file(&self) -> Option<&str>
pub fn file(&self) -> Option<&str>
The file name of the source-code location where the error was reported.
Trait Implementations§
source§impl Error for DbError
impl Error for DbError
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
impl Eq for DbError
impl StructuralPartialEq for DbError
Auto Trait Implementations§
impl Freeze for DbError
impl RefUnwindSafe for DbError
impl Send for DbError
impl Sync for DbError
impl Unpin for DbError
impl UnwindSafe for DbError
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.