Depend on anyhow directly

This removes the proxy via crate::error to depend on anyhow directly.
There is no benefit to this indirection and this makes it simpler to
see which error types are used.
This commit is contained in:
Floris Bruynooghe
2021-01-24 15:10:38 +01:00
committed by link2xt
parent 7b5a3a8346
commit 355e0145c0
28 changed files with 40 additions and 48 deletions

View File

@@ -7,6 +7,7 @@ use std::collections::HashSet;
use std::path::Path;
use std::time::Duration;
use anyhow::format_err;
use rusqlite::{Connection, Error as SqlError, OpenFlags};
use crate::chat::add_device_msg;
@@ -15,7 +16,6 @@ use crate::constants::{ShowEmails, DC_CHAT_ID_TRASH};
use crate::context::Context;
use crate::dc_tools::{dc_delete_file, time, EmailAddress};
use crate::ephemeral::start_ephemeral_timers;
use crate::error::format_err;
use crate::imap;
use crate::param::{Param, Params};
use crate::peerstate::Peerstate;
@@ -54,7 +54,7 @@ pub enum Error {
#[error("{0:?}")]
BlobError(#[from] crate::blob::BlobError),
#[error("{0}")]
Other(#[from] crate::error::Error),
Other(#[from] anyhow::Error),
}
pub type Result<T> = std::result::Result<T, Error>;
@@ -92,7 +92,7 @@ impl Sql {
context: &Context,
dbfile: T,
readonly: bool,
) -> crate::error::Result<()> {
) -> anyhow::Result<()> {
let res = open(context, self, &dbfile, readonly).await;
if let Err(err) = &res {
match err.downcast_ref::<Error>() {
@@ -697,7 +697,7 @@ async fn open(
sql: &Sql,
dbfile: impl AsRef<Path>,
readonly: bool,
) -> crate::error::Result<()> {
) -> anyhow::Result<()> {
if sql.is_open().await {
error!(
context,