|
| 1 | +use serde::{Deserialize, Serialize}; |
| 2 | + |
| 3 | +use crate::omaha::event::{EventResult, OmahaEventType}; |
| 4 | + |
| 5 | +#[derive(Debug, Eq, thiserror::Error, Serialize, Deserialize, PartialEq)] |
| 6 | +#[serde(rename_all = "kebab-case")] |
| 7 | +pub enum HarpoonError { |
| 8 | + #[error("Failed to initialize the Harpoon client: {0}")] |
| 9 | + InitializationError(String), |
| 10 | + |
| 11 | + #[error("The version provided '{version}' is not valid semver: {inner}")] |
| 12 | + InvalidVersion { version: String, inner: String }, |
| 13 | + |
| 14 | + #[error("Failed to read machine-id: {0}")] |
| 15 | + MachineIdRead(String), |
| 16 | + |
| 17 | + #[error("Failed to read hostname: {0}")] |
| 18 | + HostnameRead(String), |
| 19 | + |
| 20 | + #[error("Internal error: {0}")] |
| 21 | + Internal(String), |
| 22 | + |
| 23 | + #[error("Failed to send request: {0}")] |
| 24 | + SendRequest(String), |
| 25 | + |
| 26 | + #[error("Received an HTTP error: {0}")] |
| 27 | + HttpError(String), |
| 28 | + |
| 29 | + #[error("Failed to parse response: {0}")] |
| 30 | + ParseResponse(String), |
| 31 | + |
| 32 | + #[error("Received an invalid response from the server: {0}")] |
| 33 | + InvalidResponse(String), |
| 34 | + |
| 35 | + #[error("Failed to query for updates: {0}")] |
| 36 | + QueryError(String), |
| 37 | + |
| 38 | + #[error("Failed to fetch the updated document: {0}")] |
| 39 | + FetchError(String), |
| 40 | + |
| 41 | + #[error( |
| 42 | + "Expected a yaml document, but the provided URL does not have a .yaml extension '{0}'" |
| 43 | + )] |
| 44 | + ExpectedYamlDocument(String), |
| 45 | + |
| 46 | + #[error("Event '{0:?}:{1:?}' was not acknowledged by server.")] |
| 47 | + EventNotAcknowledged(OmahaEventType, EventResult), |
| 48 | +} |
0 commit comments