From 33bec9b7a983be34962f3ba6aa7850604c80928a Mon Sep 17 00:00:00 2001 From: Jeremy Mikola Date: Wed, 7 Dec 2011 11:33:33 -0800 Subject: [PATCH] Use InvalidArgumentException if an invalid participant is given --- Entity/Message.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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);