Improve startup error handling for SurrealCS connection pool (#4733)
Co-authored-by: Tobie Morgan Hitchcock <tobie@surrealdb.com>
This commit is contained in:
parent
b7583a653a
commit
d317a0033d
1 changed files with 6 additions and 2 deletions
|
@ -72,8 +72,12 @@ impl Drop for Transaction {
|
||||||
impl Datastore {
|
impl Datastore {
|
||||||
/// Open a new database
|
/// Open a new database
|
||||||
pub(crate) async fn new(path: &str) -> Result<Datastore, Error> {
|
pub(crate) async fn new(path: &str) -> Result<Datastore, Error> {
|
||||||
create_connection_pool(path, None).await.unwrap();
|
match create_connection_pool(path, None).await {
|
||||||
Ok(Datastore {})
|
Ok(_) => Ok(Datastore {}),
|
||||||
|
Err(_) => {
|
||||||
|
Err(Error::Ds("Cannot connect to the `surrealcs` storage engine".to_string()))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Starts a new transaction.
|
/// Starts a new transaction.
|
||||||
|
|
Loading…
Reference in a new issue