Skip to content

Commit

Permalink
refactor: Rename overloaded error e
Browse files Browse the repository at this point in the history
  • Loading branch information
peasee committed Sep 10, 2024
1 parent cac2447 commit 9e454a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
16 changes: 7 additions & 9 deletions src/duckdb/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,21 +184,19 @@ impl DataSink for DuckDBDataSink {
.context(super::ConstraintViolationSnafu)
.map_err(to_datafusion_error)?;

if let Err(e) = batch_tx.send(batch).await {
if let Err(send_error) = batch_tx.send(batch).await {
match duckdb_write_handle.await {
Err(e) => {
Err(join_error) => {
return Err(DataFusionError::Execution(format!(
"Error writing to DuckDB: {e}"
"Error writing to DuckDB: {join_error}"
)));
}
Ok(Err(e)) => {
return Err(DataFusionError::Execution(format!(
"Error writing to DuckDB: {e}"
)));
Ok(Err(datafusion_error)) => {
return Err(datafusion_error);
}
_ => {
return Err(DataFusionError::Execution(format!(
"Unable to send RecordBatch to duckdb writer: {e}"
"Unable to send RecordBatch to DuckDB writer: {send_error}"
)))
}
};
Expand All @@ -207,7 +205,7 @@ impl DataSink for DuckDBDataSink {

if notify_commit_transaction.send(()).is_err() {
return Err(DataFusionError::Execution(
"Unable to send message to commit transaction to duckdb writer.".to_string(),
"Unable to send message to commit transaction to DuckDB writer.".to_string(),
));
};

Expand Down
8 changes: 4 additions & 4 deletions src/sql/db_connection_pool/dbconnection/duckdbconn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@ impl SyncDbConnection<r2d2::PooledConnection<DuckdbConnectionManager>, DuckDBPar
}

match join_handle.await {
Ok(Err(e)) => {
Ok(Err(task_error)) => {
yield Err(DataFusionError::Execution(format!(
"Failed to execute DuckDB query: {e}"
"Failed to execute DuckDB query: {task_error}"
)))
},
Err(e) => {
Err(join_error) => {
yield Err(DataFusionError::Execution(format!(
"Failed to execute DuckDB query: {e}"
"Failed to execute DuckDB query: {join_error}"
)))
},
_ => {}
Expand Down

0 comments on commit 9e454a0

Please sign in to comment.