github_webhooks/error.rs
1pub type Result<T, E = ToEventError> = std::result::Result<T, E>;
2
3/// Errors that can occur when converting a `GithubWebhook` into an `Event`.
4#[derive(thiserror::Error, Debug)]
5pub enum ToEventError {
6 /// The `X-Hub-Signature-256` header is invalid — it couldn't be decoded.
7 #[error("X-Hub-Signature-256 header is invalid")]
8 InvalidSignature(#[from] hex::FromHexError),
9
10 /// When parsing the `X-Github-Event` header, into an `EventType`, it fails.
11 #[error("Failed to parse payload, type: {r#type}")]
12 InvalidEventType { r#type: String },
13
14 /// When parsing the payload into an `Event`, it fails.
15 #[error("Failed to parse the payload into `github::Event`")]
16 ParseFailed,
17
18 /// When verifying the signature, it fails.
19 #[error("Failed to verify the signature")]
20 VerifySignatureFailed,
21}