Closed robert-abram closed 2 years ago
Within my own projects, I defined a new JobDecorator
that I use to do this. In my JobDecorator
, it looks for a function called jobFailed()
on the Action itself, and calls that function if the job does fail.
I've submitted a PR #166 to add this functionality to Laravel Actions. I hope this helps!
Fixed by #166. Will be part of the next release (very soon, feel free to use dev-main
for now 🙂).
Hi. This is a great update - thanks.
I'm running into an error with the current release version (v2.4.0), while running my project which is using PHP 8.0.18. This is a valid version per the package requirements (^8.0).
Cannot unpack array with string keys
Looks like this is the line causing the error:
Lorisleiva\Actions\Decorators\JobDecorator:150
$this->fromActionMethod('jobFailed', [$e, ...$this->parameters], []);
Looks like this pull request introduced a dependency on PHP 8.1, because array unpacking with associative keys was only introduced in that version. https://php.watch/versions/8.1/spread-operator-string-array-keys
Possibly bump the version for the next release or look at tweaking this?
Hi there 👋 Thanks for raising this. I think this is probably more a change in Laravel since I've never seen this parameters
array be associative. Would you mind opening another issue for this?
Is it possible to handle failed job in laravel actions like in orginal laravel queue, method failed ?
https://laravel.com/docs/8.x/queues#dealing-with-failed-jobs