diff --git a/deltachat-rpc-server/src/main.rs b/deltachat-rpc-server/src/main.rs index 171edd3c1..66f9da93a 100644 --- a/deltachat-rpc-server/src/main.rs +++ b/deltachat-rpc-server/src/main.rs @@ -30,7 +30,7 @@ async fn main() { // thread, and it is impossible to cancel that read. This can make shutdown of the runtime hang // until the user presses enter." if let Err(error) = &r { - log::error!("Fatal error: {error:#}.") + log::error!("Error: {error:#}.") } std::process::exit(if r.is_ok() { 0 } else { 1 }); } diff --git a/src/accounts.rs b/src/accounts.rs index 4d18316b4..b3a72599b 100644 --- a/src/accounts.rs +++ b/src/accounts.rs @@ -4,7 +4,7 @@ use std::collections::BTreeMap; use std::future::Future; use std::path::{Path, PathBuf}; -use anyhow::{ensure, Context as _, Result}; +use anyhow::{bail, ensure, Context as _, Result}; use futures::stream::FuturesUnordered; use futures::StreamExt; use serde::{Deserialize, Serialize}; @@ -73,9 +73,7 @@ impl Accounts { let config_file = dir.join(CONFIG_NAME); ensure!(config_file.exists(), "{:?} does not exist", config_file); - let config = Config::from_file(config_file, writable) - .await - .context("failed to load accounts config")?; + let config = Config::from_file(config_file, writable).await?; let events = Events::new(); let stockstrings = StockStrings::new(); let push_subscriber = PushSubscriber::new(); @@ -460,7 +458,9 @@ impl Config { rx.await?; Ok(()) }); - locked_rx.await?; + if locked_rx.await.is_err() { + bail!("Delta Chat is already running. To use Delta Chat, you must first close the existing Delta Chat process, or restart your device. (accounts.lock file is already locked)"); + }; Ok(Some(lock_task)) }