Skip to main content

socorro_cli/
lib.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
5pub mod auth;
6pub mod cache;
7pub mod client;
8pub mod commands;
9pub mod models;
10pub mod output;
11
12pub use auth::{get_token, has_token};
13pub use client::SocorroClient;
14pub use models::*;
15pub use output::OutputFormat;
16
17pub type Result<T> = std::result::Result<T, Error>;
18
19#[derive(thiserror::Error, Debug)]
20pub enum Error {
21    #[error("HTTP request failed: {0}")]
22    Http(#[from] reqwest::Error),
23
24    #[error("JSON error: {0}")]
25    Json(#[from] serde_json::Error),
26
27    #[error("Crash not found: {0}")]
28    NotFound(String),
29
30    #[error(
31        "Rate limited. Ask a human to run 'socorro-cli auth login' to set an API token that has no permissions attached to it"
32    )]
33    RateLimited,
34
35    #[error("Failed to parse response: {0}")]
36    ParseError(String),
37
38    #[error("Invalid crash ID format: {0}")]
39    InvalidCrashId(String),
40
41    #[error("Keyring error: {0}")]
42    Keyring(String),
43}