Skip to content

Commit

Permalink
libsql/core: add error code to Error::PrepareFailed
Browse files Browse the repository at this point in the history
Add result code to `Error::PrepareFailed` so that it's available to the
user code.
  • Loading branch information
aqrln committed Aug 15, 2023
1 parent 417f64c commit cf160ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions crates/core/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
pub enum Error {
#[error("Failed to connect to database: `{0}`")]
ConnectionFailed(String),
#[error("Failed to prepare statement `{0}`: `{1}`")]
PrepareFailed(String, String),
#[error("Failed to prepare statement `{1}`: `{2}`")]
PrepareFailed(i32, String, String),
#[error("Failed to fetch row: `{0}`")]
FetchRowFailed(String),
#[error("Unknown value type for column `{0}`: `{1}`")]
Expand Down
3 changes: 2 additions & 1 deletion crates/core/src/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ impl Statement {
conn,
inner: Arc::new(stmt),
}),
Err(libsql_sys::Error::LibError(_err)) => Err(Error::PrepareFailed(
Err(libsql_sys::Error::LibError(err)) => Err(Error::PrepareFailed(
err,
sql.to_string(),
errors::error_from_handle(raw),
)),
Expand Down

0 comments on commit cf160ad

Please sign in to comment.