Skip to content

Commit 1a4ae9f

Browse files
authored
Merge pull request #9 from darkmatterfr/develop
MEP: version 1.2
2 parents 92027e7 + 3943310 commit 1a4ae9f

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/Listeners/UpdateConstellationJob.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,19 @@
66
use Illuminate\Queue\Events\JobExceptionOccurred;
77
use Illuminate\Queue\Events\JobFailed;
88
use Illuminate\Queue\Events\JobProcessed;
9+
use Illuminate\Support\Str;
910

1011
class UpdateConstellationJob
1112
{
1213
use APIHelper;
1314

1415
public function handle(JobProcessed|JobFailed|JobExceptionOccurred $event): void
1516
{
17+
$message = null;
18+
if (property_exists($event, 'exception')) {
19+
$message = $event->exception->getMessage().' in '.$event->exception->getFile().':'.$event->exception->getLine();
20+
}
21+
1622
$this->getConstellationAPIRequest()
1723
->post('/job', [
1824
'new' => false,
@@ -22,8 +28,12 @@ public function handle(JobProcessed|JobFailed|JobExceptionOccurred $event): void
2228
'failed' => $event->job->hasFailed(),
2329
'started_at' => now(),
2430
'env' => app()->environment(),
25-
'exception_message' => property_exists($event, 'exception') ?
26-
mb_strcut($event->exception->getMessage(), 0, 65535)
31+
'exception_message' => $message,
32+
'exception_trace' => property_exists($event, 'exception') ?
33+
Str::substr($event->exception->getTraceAsString(), 0, 65535)
34+
: null,
35+
'exception_type' => property_exists($event, 'exception') ?
36+
get_class($event->exception)
2737
: null,
2838
'attempt' => $event->job->attempts(),
2939
'progress' => 0,

0 commit comments

Comments
 (0)