Skip to content

mislabeled error message on stringification #200

Open
@sherrardb

Description

@sherrardb

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions