forked from apiguy/go-hmacauth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
40 lines (32 loc) · 995 Bytes
/
errors.go
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
package hmacauth
import "fmt"
const (
invalidTimestamp = "Invalid timestamp. Requires RFC3339 format."
invalidParameter = "Invalid parameter in header string"
missingParameter = "Missing parameter in header string"
tsOutOfRange = "Timestamp out of range"
signatureExpired = "Signature expired"
invalidSignature = "Invalid Signature"
invalidAPIKey = "Invalid APIKey"
secretKeyRequired = "HMACAuth Secret Key Locator Required"
repeatedParameter = "Repeated parameter: %q in header string"
missingHeader = "Missing required header: %q"
)
type HMACAuthError struct {
Message string
}
func (e HMACAuthError) Error() string {
return e.Message
}
type RepeatedParameterError struct {
ParameterName string
}
func (e RepeatedParameterError) Error() string {
return fmt.Sprintf(repeatedParameter, e.ParameterName)
}
type HeaderMissingError struct {
HeaderName string
}
func (e HeaderMissingError) Error() string {
return fmt.Sprintf(missingHeader, e.HeaderName)
}