Skip to content
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

[11.x] Catch pipeline exception #46451

Closed
wants to merge 6 commits into from
Closed

[11.x] Catch pipeline exception #46451

wants to merge 6 commits into from

Conversation

talelmishali
Copy link

This PR adds a new catch method when using a Pipeline object. Following the addition of Pipeline Facade #46271, I think it would be helpful to chain a catch callback directly on the pipeline object.

With this PR, the following would be possible:

            Pipeline::send($this->organization)
                ->via('handle')
                ->through([
                    VerifyOnboardingIsComplete::class,
                    VerifyOrganizationHasValidPaymentMethod::class,
                    ...
                ])
                ->catch(function (VerificationFailed $th) {
                    NewOrganizationHasNotBeenAuthorized::dispatch($this->organization, $th);
                })
                ->then(function (Organization $organization) {
                    NewOrganizationHasBeenAuthorized::dispatch($organization);
                });

@talelmishali talelmishali marked this pull request as ready for review March 14, 2023 00:36
@rodrigopedra
Copy link
Contributor

It seems you need to rebase your commit, as it includes unrelated commits from other users.

@talelmishali
Copy link
Author

talelmishali commented Mar 14, 2023

It seems you need to rebase your commit, as it includes unrelated commits from other users.

Ok. I see what happened. I originally tagged it for 10.x and after the comment from Taylor, I tagged it to master without rebasing it, or forking the right branch. I think it's best to close it and I will PR it properly.

xurshudyan and others added 6 commits March 13, 2023 22:49
…46445)

Co-authored-by: Valodia <v.khurshudyan@digitalpome.com>
… rerouting (#46442)

* reroute symfony events to Laravel

* unnecessary fallback (input + output is always given)

* formatting

* formatting

* wip

---------

Co-authored-by: Taylor Otwell <taylor@laravel.com>
- Add catch method to pipe
- Test catching exception on pipeline
- Update the pipeline contract to include the catch method
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.

4 participants