Handle exceptions when salmon slapping

Make it so notifyDeferred actually _always_ throws exceptions and handle
them in the places it is called.
This commit is contained in:
Mikael Nordfeldth 2016-01-20 14:55:41 +01:00
parent 80dc2788dd
commit fa8e02b832

View File

@ -376,14 +376,19 @@ class Ostatus_profile extends Managed_DataObject
public function notifyDeferred($entry, $actor) public function notifyDeferred($entry, $actor)
{ {
if ($this->salmonuri) { if ($this->salmonuri) {
common_debug("OSTATUS: user {$actor->getNickname()} ({$actor->getID()}) wants to ping {$this->localProfile()->getNickname()} on {$this->salmonuri}"); try {
$data = array('salmonuri' => $this->salmonuri, common_debug("OSTATUS: user {$actor->getNickname()} ({$actor->getID()}) wants to ping {$this->localProfile()->getNickname()} on {$this->salmonuri}");
'entry' => $this->notifyPrepXml($entry), $data = array('salmonuri' => $this->salmonuri,
'actor' => $actor->getID(), 'entry' => $this->notifyPrepXml($entry),
'target' => $this->localProfile()->getID()); 'actor' => $actor->getID(),
'target' => $this->localProfile()->getID());
$qm = QueueManager::get(); $qm = QueueManager::get();
return $qm->enqueue($data, 'salmon'); return $qm->enqueue($data, 'salmon');
} catch (Exception $e) {
common_log(LOG_ERR, 'OSTATUS: Something went wrong when creating a Salmon slap: '._ve($e->getMessage()));
return false;
}
} }
return false; return false;