Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mislabeled error message on stringification #200

Open
sherrardb opened this issue Mar 12, 2020 · 0 comments
Open

mislabeled error message on stringification #200

sherrardb opened this issue Mar 12, 2020 · 0 comments

Comments

@sherrardb
Copy link
Collaborator

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

use overload fallback => 1,
'""' => sub {
my $e = shift;
my $msg = "Error: @{[$e->type]} - @{[$e->message]}";
$msg .= " On parameter: " . $e->param if $e->param;
$msg .= "\nCard error: " . $e->code if $e->code;
return $msg;
};

we should also add a newline before 'On parameter'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant