We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent afb6b10 commit 3db1675Copy full SHA for 3db1675
sqlx-core/src/error.rs
@@ -212,6 +212,14 @@ pub trait DatabaseError: 'static + Send + Sync + StdError {
212
None
213
}
214
215
+ /// Returns the name of the table that was affected by the error, if applicable.
216
+ ///
217
+ /// ### Note
218
+ /// Currently only populated by the Postgres driver.
219
+ fn table(&self) -> Option<&str> {
220
+ None
221
+ }
222
+
223
/// Returns the kind of the error, if supported.
224
///
225
/// ### Note
sqlx-postgres/src/error.rs
@@ -204,6 +204,10 @@ impl DatabaseError for PgDatabaseError {
204
self.constraint()
205
206
207
208
+ self.table()
209
210
211
fn kind(&self) -> ErrorKind {
match self.code() {
error_codes::UNIQUE_VIOLATION => ErrorKind::UniqueViolation,
0 commit comments