stripe-perl icon indicating copy to clipboard operation
stripe-perl copied to clipboard

mislabeled error message on stringification

Open sherrardb opened this issue 5 years ago • 0 comments

GET https://api.stripe.com/v1/customers/cus_GtHh3VC7Hhwgkc

for a non-existent customer produces:

{
  "error": {
    "code": "resource_missing",
    "doc_url": "https://stripe.com/docs/error-codes/resource-missing",
    "message": "No such customer: cus_GtHh3VC7Hhwgkc",
    "param": "id",
    "type": "invalid_request_error"
  }
}

but the stringified version is:

Error: invalid_request_error - No such customer: cus_GtHh3VC7Hhwgkc On parameter: id
Card error: resource_missing

note that 'Card error' is hard-coded in the sub

https://github.com/lukec/stripe-perl/blob/b82aa508ee70a02a3731b86c4b3e1888355d05e5/lib/Net/Stripe/Error.pm#L14-L21

we should also add a newline before 'On parameter'

sherrardb avatar Mar 12 '20 13:03 sherrardb