Skip to content

Listen for errors globally #1846

Open
Open
@davidbielik

Description

@davidbielik

Is your feature request related to a problem? Please describe.

I would like to listen for errors in my Stripe calls so that I can log to my error tracking service.

I see there is stripe.on("response", (response) => {}) but it doesn't have the same details as the StripeError object.

I also noticed while upgrading my package version that you provide nice details like request_log_url (https://github.com/stripe/stripe-node/blob/master/CHANGELOG.md#10140---2022-10-13).

Is there a way to listen for all stripe response errors?

Describe the solution you'd like

const stripe = new Stripe(key, config);
stripe.on("error", (stripeError) => {
    logError(stripeError.request_log_url);
});

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions