Skip to content

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

Merged
taylorotwell merged 3 commits into
laravel:8.xfrom
ryzr:patch-2
Feb 7, 2021
Merged

[8.x] Update CallQueuedClosure to catch Throwable/Error#36159
taylorotwell merged 3 commits into
laravel:8.xfrom
ryzr:patch-2

Conversation

@ryzr

@ryzr ryzr commented Feb 6, 2021

Copy link
Copy Markdown
Contributor
  • 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

ryzr added 2 commits February 6, 2021 11:55
- 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