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:
osmaczko
2026-06-26 22:57:05 +02:00
parent 0d38dd80b7
commit 443a26d7bb
3 changed files with 11 additions and 7 deletions
+3
View File
@@ -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:?}"))