restmail_client/
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 thiserror::Error;
6
7#[derive(Error, Debug)]
8pub enum RestmailClientError {
9    #[error("Not a restmail account (doesn't end with @restmail.net)")]
10    NotARestmailEmail,
11    #[error("Max tries reached and the email couldn't be found.")]
12    HitRetryMax,
13    #[error("JSON error: {0}")]
14    JsonError(#[from] serde_json::Error),
15    #[error("Error parsing URL: {0}")]
16    Disconnect(#[from] url::ParseError),
17    #[error("Network error: {0}")]
18    RequestError(#[from] viaduct::Error),
19}