pub struct SqlErrorContext {
pub message: String,
pub line_number: Option<usize>,
pub position: Option<usize>,
pub detail: Option<String>,
pub hint: Option<String>,
pub context: Option<String>,
pub code: Option<String>,
}Expand description
Rich error context extracted from PostgreSQL errors
Fields§
§message: StringThe primary error message
line_number: Option<usize>Line number in the SQL file (converted from character position)
position: Option<usize>Character position in the SQL content (1-indexed)
detail: Option<String>Additional detail from PostgreSQL
hint: Option<String>Hint for fixing the error
context: Option<String>Context (e.g., PL/pgSQL function context)
code: Option<String>PostgreSQL error code (e.g., “42P01” for undefined_table)
Implementations§
Source§impl SqlErrorContext
impl SqlErrorContext
Sourcepub fn from_sqlx_error(error: &Error, sql_content: &str) -> Self
pub fn from_sqlx_error(error: &Error, sql_content: &str) -> Self
Extract rich error context from a sqlx error
Uses structured data from PgDatabaseError - no string parsing needed.
Trait Implementations§
Source§impl Clone for SqlErrorContext
impl Clone for SqlErrorContext
Auto Trait Implementations§
impl Freeze for SqlErrorContext
impl RefUnwindSafe for SqlErrorContext
impl Send for SqlErrorContext
impl Sync for SqlErrorContext
impl Unpin for SqlErrorContext
impl UnsafeUnpin for SqlErrorContext
impl UnwindSafe for SqlErrorContext
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more