1use std::{io, path::PathBuf, result};
2
3use advisory_lock::FileLockError;
4use thiserror::Error;
5
6use crate::{email, folder, AnyBoxedError};
7
8pub type Result<T> = result::Result<T, Error>;
10
11#[derive(Debug, Error)]
13pub enum Error {
14 #[error("cannot open sync lock file at {1}")]
15 OpenLockFileError(#[source] io::Error, PathBuf),
16 #[error("cannot lock sync file at {1}")]
17 LockFileError(#[source] FileLockError, PathBuf),
18 #[error("cannot unlock sync file at {1}")]
19 UnlockFileError(#[source] FileLockError, PathBuf),
20 #[error("cannot get sync cache directory")]
21 GetCacheDirectorySyncError,
22 #[error("cannot sync folders")]
23 SyncFoldersError(#[source] folder::Error),
24 #[error("cannot expunge folders after sync")]
25 ExpungeFoldersError(#[source] folder::Error),
26 #[error("cannot sync emails")]
27 SyncEmailsError(#[source] email::Error),
28 #[error("cannot configure left sync context")]
29 ConfigureLeftContextError(#[source] AnyBoxedError),
30 #[error("cannot configure right sync context")]
31 ConfigureRightContextError(#[source] AnyBoxedError),
32 #[error("cannot sync: left context is not configured")]
33 LeftContextNotConfiguredError(#[source] AnyBoxedError),
34 #[error("cannot sync: right context is not configured")]
35 RightContextNotConfiguredError(#[source] AnyBoxedError),
36 #[error("cannot build sync pool context")]
37 BuildSyncPoolContextError(#[source] AnyBoxedError),
38}