Skip to content

Commit

Permalink
Remove old deprecated error constants
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-stripe committed Oct 17, 2017
1 parent 2b9ce23 commit e4dec3d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
8 changes: 0 additions & 8 deletions error.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ const (
Missing ErrorCode = "missing"
ProcessingErr ErrorCode = "processing_error"
RateLimit ErrorCode = "rate_limit"

// These additional types are written purely for backward compatibility
// (the originals were given quite unsuitable names) and should be
// considered deprecated. Remove them on the next major version revision.

APIErr ErrorType = ErrorTypeAPI
CardErr ErrorType = ErrorTypeCard
InvalidRequest ErrorType = ErrorTypeInvalidRequest
)

// Error is the response returned when a call is unsuccessful.
Expand Down
4 changes: 2 additions & 2 deletions error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestErrorResponse(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Request-Id", "req_123")
w.WriteHeader(http.StatusUnauthorized)
fmt.Fprintln(w, `{"error":{"message":"bar","type":"`+InvalidRequest+`"}}`)
fmt.Fprintln(w, `{"error":{"message":"bar","type":"`+ErrorTypeInvalidRequest+`"}}`)
}))
defer ts.Close()

Expand All @@ -32,7 +32,7 @@ func TestErrorResponse(t *testing.T) {
assert.Error(t, err)

stripeErr := err.(*Error)
assert.Equal(t, InvalidRequest, stripeErr.Type)
assert.Equal(t, ErrorTypeInvalidRequest, stripeErr.Type)
assert.Equal(t, "req_123", stripeErr.RequestID)
assert.Equal(t, 401, stripeErr.HTTPStatusCode)
}

0 comments on commit e4dec3d

Please sign in to comment.