mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-02 07:21:08 +00:00
Reveal SQLite's extended error code
This commit is contained in:
parent
eda0b7dea4
commit
24d626b883
@ -2,7 +2,7 @@ use std::error::Error as StdError;
|
||||
use std::ffi::CStr;
|
||||
use std::fmt::{self, Display, Formatter};
|
||||
use std::os::raw::c_int;
|
||||
use std::str::from_utf8_unchecked;
|
||||
use std::{borrow::Cow, str::from_utf8_unchecked};
|
||||
|
||||
use libsqlite3_sys::{sqlite3, sqlite3_errmsg, sqlite3_extended_errcode};
|
||||
|
||||
@ -46,6 +46,12 @@ impl Display for SqliteError {
|
||||
impl StdError for SqliteError {}
|
||||
|
||||
impl DatabaseError for SqliteError {
|
||||
/// The extended result code.
|
||||
#[inline]
|
||||
fn code(&self) -> Option<Cow<'_, str>> {
|
||||
Some(format!("{}", self.code).into())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn message(&self) -> &str {
|
||||
&self.message
|
||||
|
Loading…
x
Reference in New Issue
Block a user