Skip to content

Commit

Permalink
Prefix all error codes properly
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-stripe committed Oct 17, 2017
1 parent e4dec3d commit 88a3345
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
25 changes: 13 additions & 12 deletions error.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@ const (
ErrorTypePermission ErrorType = "more_permissions_required"
ErrorTypeRateLimit ErrorType = "rate_limit_error"

CardDeclined ErrorCode = "card_declined"
ExpiredCard ErrorCode = "expired_card"
IncorrectNum ErrorCode = "incorrect_number"
InvalidCvc ErrorCode = "invalid_cvc"
InvalidExpM ErrorCode = "invalid_expiry_month"
InvalidExpY ErrorCode = "invalid_expiry_year"
InvalidNum ErrorCode = "invalid_number"
IncorrectCvc ErrorCode = "incorrect_cvc"
IncorrectZip ErrorCode = "incorrect_zip"
Missing ErrorCode = "missing"
ProcessingErr ErrorCode = "processing_error"
RateLimit ErrorCode = "rate_limit"
ErrorCodeCardDeclined ErrorCode = "card_declined"
ErrorCodeExpiredCard ErrorCode = "expired_card"
ErrorCodeIncorrectCvc ErrorCode = "incorrect_cvc"
ErrorCodeIncorrectZip ErrorCode = "incorrect_zip"
ErrorCodeIncorrectNumber ErrorCode = "incorrect_number"
ErrorCodeInvalidCvc ErrorCode = "invalid_cvc"
ErrorCodeInvalidExpiryMonth ErrorCode = "invalid_expiry_month"
ErrorCodeInvalidExpiryYear ErrorCode = "invalid_expiry_year"
ErrorCodeInvalidNumber ErrorCode = "invalid_number"
ErrorCodeInvalidSwipeData ErrorCode = "invalid_swipe_data"
ErrorCodeMissing ErrorCode = "missing"
ErrorCodeProcessingError ErrorCode = "processing_error"
ErrorCodeRateLimit ErrorCode = "rate_limit"
)

// Error is the response returned when a call is unsuccessful.
Expand Down
2 changes: 1 addition & 1 deletion stripe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func TestResponseToError(t *testing.T) {
// An error that contains expected fields which we're going to serialize to
// JSON and inject into our converstion function.
expectedErr := &stripe.Error{
Code: stripe.Missing,
Code: stripe.ErrorCodeMissing,
Msg: "That card was declined",
Param: "expiry_date",
Type: stripe.ErrorTypeCard,
Expand Down

0 comments on commit 88a3345

Please sign in to comment.