-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[Fix] Format exception to string in failed jobs #1961
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
Conversation
We might actually do something like this: /**
* Log a failed job into storage.
* @param string $connection
* @param string $queue
* @param string $payload
* @param \Exception $exception
* @return \MongoDB\BSON\ObjectId|null
*/
public function log($connection, $queue, $payload, $exception)
{
$failed_at = Carbon::now()->getTimestamp();
$exception = (string) $exception;
return $this->getTable()->insertGetId(compact(
'connection', 'queue', 'payload', 'exception', 'failed_at'
));
} However See: |
Format exception to string so it can be saved correctly. See https://github.com/laravel/framework/blob/6.x/src/Illuminate/Queue/Failed/DatabaseFailedJobProvider.php#L59
9cbc524
to
d5a7bac
Compare
Add tests, see here |
There is no complete tests for jobs so I'm not sure if we should do that now? Also function I think better example for tests would be https://github.com/laravel/framework/tree/6.x/tests/Queue |
Yes, Laravel tests are more complete. It would be awesome if you add tests for all job features. |
Even making a breaking changes is fine? 😀 |
[Fix] Format exception to string in failed jobs
Format exception to string in failed job so it can be saved correctly.
See: https://github.com/laravel/framework/blob/6.x/src/Illuminate/Queue/Failed/DatabaseFailedJobProvider.php#L59
Closes: #1800, #1524, #1480