mirror of
https://git.funtimes909.xyz/ServerSeekerV2/ServerSeekerV2.git
synced 2026-10-11 09:58:10 +08:00
Prettier database error messages
This commit is contained in:
1 parent
acbe236580
commit
b01e85a232
1 file changed
+7
-1
+7
-1
@@ -4,7 +4,13 @@ use sqlx::postgres::PgQueryResult;
|
||||
use crate::response::Server;
|
||||
|
||||
pub async fn connect(database_url: &str) -> PgConnection {
|
||||
PgConnection::connect(&database_url).await.expect("Failed to connect to database!")
|
||||
match PgConnection::connect(&database_url).await {
|
||||
Ok(conn) => conn,
|
||||
Err(error) => {
|
||||
println!("Failed to connect to database: {}", error);
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO! Return a stream of results instead of a Vec for performance
|
||||
|
||||
Reference in new issue
Block a user