Skip to content

Add failWhen method to ThrottlesExceptions job middleware#56180

Merged
taylorotwell merged 3 commits into
laravel:12.xfrom
michaeldzjap:12.x
Jul 1, 2025
Merged

Add failWhen method to ThrottlesExceptions job middleware#56180
taylorotwell merged 3 commits into
laravel:12.xfrom
michaeldzjap:12.x

Conversation

@michaeldzjap

@michaeldzjap michaeldzjap commented Jun 30, 2025

Copy link
Copy Markdown
Contributor

This PR adds a failWhen method to the ThrottlesExceptions job middleware. Currently, this middleware only allows for deleting the job when a specific exception is thrown. There are occasions were you would want to mark the job as failed instead. For instance: in the context of a job chain it may be desirable to fail a job when an exception is thrown so that the chain stops executing. With the current deleteWhen method this is not possible.

See discussion #56174 for more context.

@github-actions

Copy link
Copy Markdown

Thanks for submitting a PR!

Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@michaeldzjap michaeldzjap marked this pull request as ready for review June 30, 2025 17:16
@michaeldzjap michaeldzjap marked this pull request as draft June 30, 2025 17:18
@michaeldzjap michaeldzjap marked this pull request as ready for review June 30, 2025 17:20
@taylorotwell taylorotwell merged commit 2cd7ba9 into laravel:12.x Jul 1, 2025
39 of 60 checks passed
mohammad-fouladgar pushed a commit to mohammad-fouladgar/framework that referenced this pull request Jul 22, 2025
)

* feat: add failWhen method to throttles exceptions job middleware

* test: add test for failWhen method

* test: adjust expectation
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

Successfully merging this pull request may close these issues.

2 participants