add: provide more information on psql and redis connection errors
This commit is contained in:
parent
013bc0b45f
commit
22ae479bd7
4 changed files with 23 additions and 9 deletions
7
crates/core/src/cache/redis.rs
vendored
7
crates/core/src/cache/redis.rs
vendored
|
@ -16,12 +16,15 @@ impl Cache for RedisCache {
|
|||
|
||||
async fn new() -> Self {
|
||||
Self {
|
||||
client: redis::Client::open("redis://127.0.0.1:6379").unwrap(),
|
||||
client: redis::Client::open("redis://127.0.0.1:6379")
|
||||
.expect("ERROR_TETRATTO_REDIS_CON"),
|
||||
}
|
||||
}
|
||||
|
||||
async fn get_con(&self) -> Self::Client {
|
||||
self.client.get_connection().unwrap()
|
||||
self.client
|
||||
.get_connection()
|
||||
.expect("ERROR_TETRATTO_PSQL_CON_ACQUIRE")
|
||||
}
|
||||
|
||||
async fn get(&self, id: Self::Item) -> Option<String> {
|
||||
|
|
|
@ -30,7 +30,7 @@ pub struct DataManager(
|
|||
impl DataManager {
|
||||
/// Obtain a connection to the staging database.
|
||||
pub(crate) async fn connect(&self) -> Result<Connection> {
|
||||
Ok(self.3.get().await.unwrap())
|
||||
Ok(self.3.get().await.expect("ERROR_TETRATTO_PSQL_CON"))
|
||||
}
|
||||
|
||||
/// Create a new [`DataManager`] (and init database).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue