sync_manager/
error.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5use interrupt_support::Interrupted;
6
7#[derive(Debug, thiserror::Error)]
8pub enum SyncManagerError {
9    #[error("Unknown engine: {0}")]
10    UnknownEngine(String),
11    #[error("Manager was compiled without support for {0:?}")]
12    UnsupportedFeature(String),
13    // Used for things like 'failed to decode the provided sync key because it's
14    // completely the wrong format', etc.
15    #[error("Sync error: {0}")]
16    Sync15Error(#[from] sync15::Error),
17    #[error("URL parse error: {0}")]
18    UrlParseError(#[from] url::ParseError),
19    #[error("Operation interrupted")]
20    InterruptedError(#[from] Interrupted),
21    #[error("Error parsing JSON data: {0}")]
22    JsonError(#[from] serde_json::Error),
23    #[error("Logins error: {0}")]
24    LoginsError(#[from] logins::Error),
25    #[error("Places error: {0}")]
26    PlacesError(#[from] places::Error),
27    // We should probably upgrade this crate to anyhow, which would mean this
28    // gets replaced with AutofillError or similar.
29    #[error("External error: {0}")]
30    AnyhowError(#[from] anyhow::Error),
31}
32
33pub type Result<T> = std::result::Result<T, SyncManagerError>;