-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy patherror.rs
More file actions
70 lines (54 loc) · 1.99 KB
/
error.rs
File metadata and controls
70 lines (54 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
use std::borrow::Cow;
use httpsig::prelude::HttpSigError;
use thiserror::Error;
/// Result type for http signature
pub type HyperSigResult<T> = std::result::Result<T, HyperSigError>;
/// Error type for http signature for hyper
#[derive(Error, Debug)]
pub enum HyperSigError {
/// No signature headers found
#[error("No signature headers found: {0}")]
NoSignatureHeaders(&'static str),
/// Failed to parse signature headers
#[error("Failed to stringify signature headers: {0}")]
FailedToStrSignatureHeaders(#[from] http::header::ToStrError),
/// Failed to parse header value
#[error("Failed to parse header value: {0}")]
InvalidHeaderValue(#[from] http::header::InvalidHeaderValue),
/// Invalid component name
#[error("Invalid component name: {0}")]
InvalidComponentName(Cow<'static, str>),
/// Invalid component param
#[error("Invalid component param: {0}")]
InvalidComponentParam(String),
/// Invalid signature
#[error("Invalid signature: {0}")]
InvalidSignature(&'static str),
/// Inherited from HttpSigError
#[error("HttpSigError: {0}")]
HttpSigError(#[from] HttpSigError),
}
/// Result type for http signature
pub type HyperDigestResult<T> = std::result::Result<T, HyperDigestError>;
/// Error type for http signature for hyper
#[derive(Error, Debug)]
pub enum HyperDigestError {
/// Http body error
#[error("Http body error: {0}")]
HttpBodyError(String),
/// No content-digest header found
#[error("No content-digest header found: {0}")]
NoDigestHeader(String),
/// Failed to parse header value
#[error("Failed to parse header value: {0}")]
InvalidHeaderValue(String),
/// Failed to parse content digest headers
#[error("Failed to stringify content-digest header: {0}")]
FailedToStrDigestHeader(#[from] http::header::ToStrError),
/// Invalid content-digest
#[error("Invalid content-digest: {0}")]
InvalidContentDigest(String),
/// Invalid content-digest type
#[error("Invalid content-digest type: {0}")]
InvalidContentDigestType(String),
}