Skip to content

Errors are turned into exceptions, with no way to gate/filter them #60520

@mewejo

Description

@mewejo

Laravel Version

13.x

PHP Version

8.5.x

Database Driver & Version

No response

Description

I recently attempted an upgrade to Stripe SDK v20, but this commit has blocked me: stripe/stripe-php#2071

It triggers an error if the Stripe API returns a Stripe-Notice header. This happens if you're not running the latest Stripe API version (quite common, and will happen the moment Stripe update their API, too).

The error is triggered, and Laravel turns it into \ErrorException in \Illuminate\Foundation\Bootstrap\HandleExceptions::handleError.

This exception is then handled by handleException which ultimately throws it back as a 500 error.

There is no way to filter or handle errors before they're turned into exceptions. In this case for Stripe, I'd like to log the error/warning, but not kill the application life cycle.

Steps To Reproduce

Trigger an error which should be reported, it turns into an exception.

Stripe Specific

The Stripe API only returns this notice header on test mode, but that's not much help, as you may not want to update the Stripe API version, but you will be blocked from developing locally until you do.

An error filter would allow developers to choose what is and isn't transformed into an ErrorException.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions