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

[8.x] Update CallQueuedClosure to catch Throwable/Error #36159

Merged
merged 3 commits into from
Feb 7, 2021
Merged

[8.x] Update CallQueuedClosure to catch Throwable/Error #36159

merged 3 commits into from
Feb 7, 2021

Conversation

ryzr
Copy link
Contributor

@ryzr ryzr commented Feb 6, 2021

  • Laravel Version: 8.26.1
  • PHP Version: 8.0.0

Description:

Queued closures that throw an Error will throw again when handled by CallQueuedClosure@failed, as its currently type-hinted for Exceptions only.

Steps To Reproduce:

Bus::chain([
    function () {
        SomeClassThatDoesntExist::foo();
    }
])->dispatch();

The above will first throw Error Class "SomeClassThatDoesntExist" not found. The queue will attempt to handle it and throw again: TypeError Illuminate\Queue\CallQueuedClosure::failed(): Argument #1 ($e) must be of type Exception, Error given, called in /var/task/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php on line 261

- Laravel Version: 8.26.1
- PHP Version: 8.0.0

### Description:
Queued closures that throw an Error will throw again when handled by CallQueuedClosure@failed, as its currently type-hinted for Exceptions only.

### Steps To Reproduce:
```php
Bus::chain([
    function () {
        SomeClassThatDoesntExist::throw();
    }
])->dispatch();
```

The above will first throw `Error Class "SomeClassThatDoesntExist" not found`. The queue will attempt to handle it and throw again: `TypeError
Illuminate\Queue\CallQueuedClosure::failed(): Argument #1 ($e) must be of type Exception, Error given, called in /var/task/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php on line 261`
@GrahamCampbell GrahamCampbell changed the title Update CallQueuedClosure to catch Throwable/Error [8.x] Update CallQueuedClosure to catch Throwable/Error Feb 6, 2021
@taylorotwell taylorotwell merged commit 2ecc0b4 into laravel:8.x Feb 7, 2021
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