diff --git a/Entity/Message.php b/Entity/Message.php index b81e0cc0..f723dfb3 100644 --- a/Entity/Message.php +++ b/Entity/Message.php @@ -44,12 +44,12 @@ public function isReadByParticipant(ParticipantInterface $participant) * * @param ParticipantInterface $participant * @param boolean $isRead + * @throws InvalidArgumentException if no metadata exists for the participant */ public function setIsReadByParticipant(ParticipantInterface $participant, $isRead) { - $meta = $this->getMetadataForParticipant($participant); - if (!$meta) { - throw new \Exception(sprintf('No metadata setted for participant with id "%s"', $participant->getId())); + if (!$meta = $this->getMetadataForParticipant($participant)) { + throw new \InvalidArgumentException(sprintf('No metadata exists for participant with id "%s"', $participant->getId())); } $meta->setIsRead($isRead);