From 66e7bc22cfce9319076eb5922c5685c6d811f075 Mon Sep 17 00:00:00 2001 From: davidemazzocchi Date: Mon, 16 Mar 2026 09:26:07 +0100 Subject: [PATCH] chore: add source() implementation to internal sqlite::FailedTo error --- 01.workspace/heave/src/str/sqlite_failed_to.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/01.workspace/heave/src/str/sqlite_failed_to.rs b/01.workspace/heave/src/str/sqlite_failed_to.rs index 3bb2847..6bdc019 100644 --- a/01.workspace/heave/src/str/sqlite_failed_to.rs +++ b/01.workspace/heave/src/str/sqlite_failed_to.rs @@ -19,7 +19,20 @@ pub enum FailedTo { PrepareStatement(rusqlite::Error), } -impl std::error::Error for FailedTo {} +impl std::error::Error for FailedTo { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + FailedTo::BeginTransaction(e) => Some(e), + FailedTo::BuildStatement => None, + FailedTo::CommitTransaction(e) => Some(e), + FailedTo::ExecuteBatch(e) => Some(e), + FailedTo::ExecuteQuery(e) => Some(e), + FailedTo::ExecuteStatement(e) => Some(e), + FailedTo::OpenConnection(e) => Some(e), + FailedTo::PrepareStatement(e) => Some(e), + } + } +} impl std::fmt::Display for FailedTo { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::result::Result<(), std::fmt::Error> {