Skip to content
Snippets Groups Projects
Verified Commit cbd1471c authored by Dillenn Terumalai's avatar Dillenn Terumalai :speech_balloon:
Browse files

fix: Restored the onFailure callback

It was causing issues when trying to throw the exception and output the std_err file content.
parent 2eaad711
No related branches found
No related tags found
No related merge requests found
Pipeline #5890 passed
......@@ -6,11 +6,6 @@ use Dterumal\LaravelCluster\Events\JobFailed;
class ExecuteJobFailureCallback
{
/**
* @var string
*/
public string $exception = 'Job failed';
/**
* Handle the event.
*
......@@ -21,16 +16,8 @@ class ExecuteJobFailureCallback
{
$jobClass = $event->job->job;
try {
if (file_exists($this->job->std_err_path)) {
$this->exception = file_get_contents($this->job->std_err_path);
}
throw new \Exception($this->exception);
} catch (\Throwable $e) {
if (method_exists($jobClass, 'onFailure')) {
$jobClass->onFailure($event->job, $e);
}
$jobClass->onFailure($event->job);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment