You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
This feature request is to track community interest in stripe-go API calls returning a nil pointer when the error is not nil. The current behavior in stripe-go when the API call errors is to return both an error and a pointer to a struct with empty / zero value fields.
We've recently been informed that stripe-go does not follow the typical Go convention of returning the zero value (nil in the case of pointers) when an API call function returns a non-nil error value. This convention is not officially documented anywhere as far as we know, but is generally followed (see this related StackOverflow post).
Please feel free to upvote or comment if you would like this feature in stripe-go (or comment with arguments against making this change).
Describe the solution you'd like
In the following function call to create a new payment intent given bad params which raise an error
pi, err:=paymentintent.New(badParams) // errors
Old behavior:pi is a pointer to a struct with empty fields on error New behavior:pi is nil on error
Is your feature request related to a problem? Please describe.
This feature request is to track community interest in stripe-go API calls returning a
nil
pointer when the error is notnil
. The current behavior in stripe-go when the API call errors is to return both an error and a pointer to a struct with empty / zero value fields.We've recently been informed that stripe-go does not follow the typical Go convention of returning the zero value (
nil
in the case of pointers) when an API call function returns a non-nil error value. This convention is not officially documented anywhere as far as we know, but is generally followed (see this related StackOverflow post).Please feel free to upvote or comment if you would like this feature in stripe-go (or comment with arguments against making this change).
Describe the solution you'd like
In the following function call to create a new payment intent given bad params which raise an error
Old behavior:
pi
is a pointer to a struct with empty fields on errorNew behavior:
pi
isnil
on errorDescribe alternatives you've considered
No response
Additional context
Related links:
Is it conventional to return both value and error from function at the same time SO post
Stripe docs for error handling
The text was updated successfully, but these errors were encountered: