mirror of
https://github.com/logos-messaging/libchat.git
synced 2026-08-27 08:01:09 +00:00
feat: re-export ChatStorage and make storage_config fallible
Callers that build an encrypted store had to depend on `libchat` directly for `ChatStorage`, and `ChatClientBuilder::storage_config` panicked on a bad config, which aborts the process under `panic = "abort"`. - Re-export `ChatStorage` from logos-chat so callers can name the store type without a direct `libchat` dependency. - `storage_config` now returns `Result<_, ChatError>` instead of `.expect()`, so an unopenable database surfaces as an error. Updates the chat-cli callers.
This commit is contained in:
@@ -119,6 +119,7 @@ fn run<T: Transport>(transport: T, cli: &Cli) -> Result<()> {
|
||||
let (client, events) = ChatClientBuilder::new()
|
||||
.transport(transport)
|
||||
.storage_config(storage)
|
||||
.map_err(|e| anyhow::anyhow!("{e:?}"))?
|
||||
.registration(registry)
|
||||
.build()
|
||||
.map_err(|e| anyhow::anyhow!("{e:?}"))
|
||||
@@ -129,6 +130,7 @@ fn run<T: Transport>(transport: T, cli: &Cli) -> Result<()> {
|
||||
let (client, events) = ChatClientBuilder::new()
|
||||
.transport(transport)
|
||||
.storage_config(storage)
|
||||
.map_err(|e| anyhow::anyhow!("{e:?}"))?
|
||||
.build()
|
||||
.map_err(|e| anyhow::anyhow!("{e:?}"))
|
||||
.context("failed to open chat client")?;
|
||||
@@ -197,6 +199,7 @@ fn run_logos_delivery(cli: Cli) -> Result<()> {
|
||||
path: db_str,
|
||||
key: "chat-cli".to_string(),
|
||||
})
|
||||
.map_err(|e| anyhow::anyhow!("{e:?}"))?
|
||||
.transport(delivery)
|
||||
.build()
|
||||
.map_err(|e| anyhow::anyhow!("{e:?}"))
|
||||
|
||||
Reference in New Issue
Block a user