Skip to content

Commit 6cfd1d8

Browse files
committed
fix(odbc): improve error handling in worker thread communication
1 parent 4cdf84f commit 6cfd1d8

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

sqlx-core/src/odbc/connection/worker.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,16 +167,19 @@ fn worker_thread_main(
167167
// Establish connection
168168
let conn = match establish_connection(&options) {
169169
Ok(conn) => {
170-
conn_tx.send(Ok(())).unwrap();
170+
let _ = conn_tx.send(Ok(()));
171171
conn
172172
}
173-
Err(e) => return conn_tx.send(Err(e)).unwrap(),
173+
Err(e) => {
174+
let _ = conn_tx.send(Err(e));
175+
return;
176+
}
174177
};
175178
// Process commands
176179
while let Ok(cmd) = command_rx.recv() {
177180
if let Some(shutdown_tx) = process_command(cmd, &conn) {
178181
drop(conn);
179-
shutdown_tx.send(()).unwrap();
182+
let _ = shutdown_tx.send(());
180183
break;
181184
}
182185
}
@@ -197,11 +200,11 @@ fn establish_connection(options: &OdbcConnectOptions) -> Result<OdbcConnection,
197200

198201
// Utility functions for channel operations
199202
fn send_result<T: std::fmt::Debug>(tx: oneshot::Sender<T>, result: T) {
200-
tx.send(result).expect("The odbc worker thread has crashed");
203+
let _ = tx.send(result);
201204
}
202205

203206
fn send_stream_result(tx: &ExecuteSender, result: ExecuteResult) {
204-
tx.send(result).expect("The odbc worker thread has crashed");
207+
let _ = tx.send(result);
205208
}
206209

207210
async fn send_command_and_await<T>(

0 commit comments

Comments
 (0)