fix: enhance error message clarity for database connection failures

This commit is contained in:
lovasoa
2025-08-30 17:23:44 +02:00
parent 637f198b57
commit b85bf2c9ea
+3 -1
View File
@@ -249,7 +249,9 @@ async fn take_connection<'a>(
Ok(conn.as_mut().unwrap())
}
Err(e) => {
let err_msg = format!("Unable to acquire a database connection to execute the SQL file. All of the {} {:?} connections are busy.", db.connection.size(), db.connection.any_kind());
let db_name = db.connection.any_kind();
let active_count = db.connection.size();
let err_msg = format!("Unable to acquire a {db_name:?} database connection to execute the SQL file. The connection pool currently has {active_count} active connections.");
Err(anyhow::Error::new(e).context(err_msg))
}
}