-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy patherrors.go
42 lines (37 loc) · 1.8 KB
/
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
41
42
package httpsign
import (
"errors"
"github.com/gin-gonic/gin"
)
func newPublicError(msg string) *gin.Error {
return &gin.Error{
Err: errors.New(msg),
Type: gin.ErrorTypePublic,
}
}
var (
// ErrInvalidAuthorizationHeader error when get invalid format of Authorization header
ErrInvalidAuthorizationHeader = newPublicError("Authorization header format is incorrect")
// ErrInvalidKeyID error when KeyID in header does not provided
ErrInvalidKeyID = newPublicError("Invalid keyId")
// ErrDateNotFound error when no date in header
ErrDateNotFound = newPublicError("There is no Date on Headers")
// ErrIncorrectAlgorithm error when Algorithm in header does not match with secret key
ErrIncorrectAlgorithm = newPublicError("Algorithm does not match")
// ErrHeaderNotEnough error when requirements header do not appear on header field
ErrHeaderNotEnough = newPublicError("Header field is not match requirement")
// ErrNoSignature error when no Signature not found in header
ErrNoSignature = newPublicError("No Signature header found in request")
// ErrInvalidSign error when signing string do not match
ErrInvalidSign = newPublicError("Invalid sign")
// ErrMissingKeyID error when keyId not in header
ErrMissingKeyID = newPublicError("keyId must be on header")
// ErrMissingSignature error when signature not in header
ErrMissingSignature = newPublicError("signature must be on header")
// ErrUnterminatedParameter err when could not parse value
ErrUnterminatedParameter = newPublicError("Unterminated parameter")
// ErrMisingDoubleQuote err when after character = not have double quote
ErrMisingDoubleQuote = newPublicError(`Missing " after = character`)
// ErrMisingEqualCharacter err when there is no character = before " or , character
ErrMisingEqualCharacter = newPublicError(`Missing = character =`)
)