Print more anyhow errors with their causes

This commit is contained in:
link2xt
2023-01-04 14:37:12 +00:00
parent 2b4e32d2cf
commit 754c7324f5
11 changed files with 49 additions and 46 deletions

View File

@@ -157,7 +157,7 @@ impl Job {
/// Synchronizes UIDs for all folders.
async fn resync_folders(&mut self, context: &Context, imap: &mut Imap) -> Status {
if let Err(err) = imap.prepare(context).await {
warn!(context, "could not connect: {:?}", err);
warn!(context, "could not connect: {:#}", err);
return Status::RetryLater;
}
@@ -246,7 +246,7 @@ pub(crate) async fn perform_job(context: &Context, mut connection: Connection<'_
time_offset
);
job.save(context).await.unwrap_or_else(|err| {
error!(context, "failed to save job: {}", err);
error!(context, "failed to save job: {:#}", err);
});
} else {
info!(
@@ -254,7 +254,7 @@ pub(crate) async fn perform_job(context: &Context, mut connection: Connection<'_
"remove job {} as it exhausted {} retries", job, JOB_RETRIES
);
job.delete(context).await.unwrap_or_else(|err| {
error!(context, "failed to delete job: {}", err);
error!(context, "failed to delete job: {:#}", err);
});
}
}
@@ -269,7 +269,7 @@ pub(crate) async fn perform_job(context: &Context, mut connection: Connection<'_
}
job.delete(context).await.unwrap_or_else(|err| {
error!(context, "failed to delete job: {}", err);
error!(context, "failed to delete job: {:#}", err);
});
}
}
@@ -403,7 +403,7 @@ LIMIT 1;
Ok(job) => return Ok(job),
Err(err) => {
// Remove invalid job from the DB
info!(context, "cleaning up job, because of {}", err);
info!(context, "cleaning up job, because of {:#}", err);
// TODO: improve by only doing a single query
let id = context