forked from drone/go.stripe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.go
More file actions
37 lines (33 loc) · 1.1 KB
/
error.go
File metadata and controls
37 lines (33 loc) · 1.1 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
package stripe
// Stripe-provided error codes and types
// See https://stripe.com/docs/api#errors
const (
ErrTypeInvalidRequest = "invalid_request_error"
ErrTypeAPI = "api_error"
ErrTypeCard = "card_error"
ErrCodeIncorrectNumber = "incorrect_number"
ErrCodeInvalidNumber = "invalid_number"
ErrCodeInvalidExpiryMonth = "invalid_expiry_month"
ErrCodeInvalidExpiryYear = "invalid_expiry_year"
ErrCodeInvalidCVC = "invalid_cvc"
ErrCodeExpiredCard = "expired_card"
ErrCodeIncorrectCVC = "incorrect_cvc"
ErrCodeIncorrectZIP = "incorrect_zip"
ErrCodeCardDeclined = "card_declined"
ErrCodeMissing = "missing"
ErrCodeProcessingError = "processing_error"
)
// Error encapsulates an error returned by the Stripe REST API.
// Detail.Code and Detail.Param may be empty.
type Error struct {
Code int
Detail struct {
Type string `json:"type"`
Message string `json:"message"`
Code string `json:"code,omitempty"`
Param string `json:"param,omitempty"`
} `json:"error"`
}
func (e *Error) Error() string {
return e.Detail.Message
}