Skip to content

Commit c2b3c16

Browse files
committed
fix: improve report job fail handling
1 parent fb84ba3 commit c2b3c16

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

app/Jobs/GenerateReport/Standard/GenerateStandardReportJob.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,16 @@ abstract public function generate(): void;
5757

5858
public function handle(): void
5959
{
60-
rescue(function () {
61-
$this->generate();
60+
$this->generate();
6261

63-
$this->report->status = Status::FINISHED;
64-
}, function (Throwable $e) {
65-
$this->report->status = Status::FAILED;
62+
$this->report->status = Status::FINISHED;
6663

67-
$this->fail($e);
68-
});
64+
$this->report->save();
65+
}
66+
67+
public function failed(?Throwable $exception): void
68+
{
69+
$this->report->status = Status::FAILED;
6970

7071
$this->report->save();
7172
}

0 commit comments

Comments
 (0)