Skip to content

Commit bdd62b9

Browse files
committed
Fix sending notifications
1 parent d4f5626 commit bdd62b9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Server.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,15 @@ public function connect(TransportInterface $transport): void
6666
}
6767

6868
foreach ($this->notificationPublisher->flush() as $notification) {
69-
$transport->send($notification);
69+
try {
70+
$transport->send(json_encode($notification, \JSON_THROW_ON_ERROR));
71+
} catch (\JsonException $e) {
72+
$this->logger->error('Failed to encode notification to JSON.', [
73+
'notification' => $notification::class,
74+
'exception' => $e,
75+
]);
76+
continue;
77+
}
7078
}
7179

7280
usleep(1000);

0 commit comments

Comments
 (0)