mirror of
https://github.com/chatmail/core.git
synced 2026-05-09 01:46:30 +03:00
fix: better error message when backup version is too old
This commit is contained in:
11
src/imex.rs
11
src/imex.rs
@@ -17,7 +17,6 @@ use crate::blob::BlobDirContents;
|
|||||||
use crate::chat::delete_and_reset_all_device_msgs;
|
use crate::chat::delete_and_reset_all_device_msgs;
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::context::Context;
|
use crate::context::Context;
|
||||||
use crate::e2ee;
|
|
||||||
use crate::events::EventType;
|
use crate::events::EventType;
|
||||||
use crate::key::{self, DcKey, DcSecretKey, SignedPublicKey, SignedSecretKey};
|
use crate::key::{self, DcKey, DcSecretKey, SignedPublicKey, SignedSecretKey};
|
||||||
use crate::log::{error, info, warn, LogExt};
|
use crate::log::{error, info, warn, LogExt};
|
||||||
@@ -27,6 +26,7 @@ use crate::sql;
|
|||||||
use crate::tools::{
|
use crate::tools::{
|
||||||
create_folder, delete_file, get_filesuffix_lc, read_file, time, write_file, TempPathGuard,
|
create_folder, delete_file, get_filesuffix_lc, read_file, time, write_file, TempPathGuard,
|
||||||
};
|
};
|
||||||
|
use crate::{e2ee, stock_str};
|
||||||
|
|
||||||
mod key_transfer;
|
mod key_transfer;
|
||||||
mod transfer;
|
mod transfer;
|
||||||
@@ -102,7 +102,14 @@ pub async fn imex(
|
|||||||
|
|
||||||
if let Err(err) = res.as_ref() {
|
if let Err(err) = res.as_ref() {
|
||||||
// We are using Anyhow's .context() and to show the inner error, too, we need the {:#}:
|
// We are using Anyhow's .context() and to show the inner error, too, we need the {:#}:
|
||||||
error!(context, "IMEX failed to complete: {:#}", err);
|
if err
|
||||||
|
.to_string()
|
||||||
|
.contains("Backup too new, please update Delta Chat")
|
||||||
|
{
|
||||||
|
error!(context, "{}", stock_str::old_backup(context));
|
||||||
|
} else {
|
||||||
|
error!(context, "IMEX failed to complete: {:#}", err);
|
||||||
|
}
|
||||||
context.emit_event(EventType::ImexProgress(0));
|
context.emit_event(EventType::ImexProgress(0));
|
||||||
} else {
|
} else {
|
||||||
info!(context, "IMEX successfully completed");
|
info!(context, "IMEX successfully completed");
|
||||||
|
|||||||
@@ -395,6 +395,9 @@ pub enum StockMessage {
|
|||||||
#[strum(props(fallback = "I left the group."))]
|
#[strum(props(fallback = "I left the group."))]
|
||||||
MsgILeftGroup = 166,
|
MsgILeftGroup = 166,
|
||||||
|
|
||||||
|
#[strum(props(fallback = "The imported backup version is too old"))]
|
||||||
|
OldBackupVersion = 167,
|
||||||
|
|
||||||
#[strum(props(fallback = "Messages are guaranteed to be end-to-end encrypted from now on."))]
|
#[strum(props(fallback = "Messages are guaranteed to be end-to-end encrypted from now on."))]
|
||||||
ChatProtectionEnabled = 170,
|
ChatProtectionEnabled = 170,
|
||||||
|
|
||||||
@@ -570,6 +573,10 @@ pub(crate) async fn video(context: &Context) -> String {
|
|||||||
translated(context, StockMessage::Video).await
|
translated(context, StockMessage::Video).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) async fn old_backup(context: &Context) -> String {
|
||||||
|
translated(context, StockMessage::OldBackupVersion)
|
||||||
|
}
|
||||||
|
|
||||||
/// Stock string: `Audio`.
|
/// Stock string: `Audio`.
|
||||||
pub(crate) async fn audio(context: &Context) -> String {
|
pub(crate) async fn audio(context: &Context) -> String {
|
||||||
translated(context, StockMessage::Audio).await
|
translated(context, StockMessage::Audio).await
|
||||||
|
|||||||
Reference in New Issue
Block a user