Return the newly created notification for handling
This commit is contained in:
@ -112,7 +112,7 @@ class InstagramNotificationHandlingJob extends InstagramAbstractJob implements S
|
||||
}
|
||||
}
|
||||
|
||||
private function saveNotifications(Browser $browser): void
|
||||
private function saveNotifications(Browser $browser): ?array
|
||||
{
|
||||
$this->openNotificationsPanel($browser);
|
||||
try {
|
||||
@ -135,8 +135,7 @@ class InstagramNotificationHandlingJob extends InstagramAbstractJob implements S
|
||||
if ($repostId) {
|
||||
$notification->instagram_repost_id = $repostId;
|
||||
}
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
Log::error("Failed to get post ID from notification : " . $e->getMessage());
|
||||
}
|
||||
$notification->message = $DOMnotificationText->getText();
|
||||
@ -146,16 +145,17 @@ class InstagramNotificationHandlingJob extends InstagramAbstractJob implements S
|
||||
$notification->save();
|
||||
} catch (\Exception $e) {
|
||||
Log::error("Failed to save notification : " . $e->getMessage());
|
||||
continue; // Skip to the next notification
|
||||
break; // Stop processing further notifications if one fails
|
||||
}
|
||||
dump("Notification saved : " . $notification);
|
||||
$notifications[] = $notification;
|
||||
}
|
||||
return $notifications;
|
||||
} catch (\Exception $e) {
|
||||
Log::error("Failed to get notifications : " . $e->getMessage());
|
||||
$browser->screenshot(JobDebugScreenshot::getFileName($this->jobId));
|
||||
AllNotification::send(new JobDebugNotification($this->jobId, "Failed to open notifications panel: " . $e->getMessage()));
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user