Skip to content

Add SkipOnException queue middleware #56578

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

Draft
wants to merge 1 commit into
base: 12.x
Choose a base branch
from

Conversation

yankewei
Copy link

@yankewei yankewei commented Aug 7, 2025

Add SkipOnException Queue Middleware

Problem

Currently, when a job throws an exception, it either fails or retries. There's no built-in way to make a job complete successfully when certain exceptions occur.

Solution

This PR adds SkipOnException middleware that allows jobs to complete normally when specific exceptions are thrown, instead of failing or retrying.

Usage:

public function middleware()
{
    return [
        new SkipOnException([
            ThirdPartyApiException::class,
            OptionalServiceException::class,
        ]),
    ];
}

Copy link

github-actions bot commented Aug 7, 2025

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.

@antonkomarev
Copy link
Contributor

But you can use try-catch in the job, to make this behaviour obvious.

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