Skip to content

Commit

Permalink
Use InvalidArgumentException if an invalid participant is given
Browse files Browse the repository at this point in the history
  • Loading branch information
jmikola committed Dec 7, 2011
1 parent 4866719 commit 33bec9b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Entity/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 33bec9b

Please sign in to comment.