66use Illuminate \Queue \Events \JobExceptionOccurred ;
77use Illuminate \Queue \Events \JobFailed ;
88use Illuminate \Queue \Events \JobProcessed ;
9+ use Illuminate \Support \Str ;
910
1011class 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