From deda83fdef06bafe9f419fc33c5d11610c9e21c3 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sat, 16 Jan 2016 22:36:42 +0100 Subject: [PATCH] Distinguish notice saving errors from others for Salmon --- classes/Notice.php | 2 +- lib/noticesaveexception.php | 17 +++++++++++++++++ plugins/OStatus/lib/salmonaction.php | 2 ++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 lib/noticesaveexception.php diff --git a/classes/Notice.php b/classes/Notice.php index 963b24ba5e..523c609991 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -950,7 +950,7 @@ class Notice extends Managed_DataObject $object = null; Event::handle('StoreActivityObject', array($act, $stored, $options, &$object)); if (empty($object)) { - throw new ServerException('Unsuccessful call to StoreActivityObject '.$stored->getUri() . ': '.$act->asString()); + throw new NoticeSaveException('Unsuccessful call to StoreActivityObject '._ve($stored->getUri()) . ': '._ve($act->asString())); } // If something changed in the Notice during StoreActivityObject diff --git a/lib/noticesaveexception.php b/lib/noticesaveexception.php new file mode 100644 index 0000000000..2e34a1a7e2 --- /dev/null +++ b/lib/noticesaveexception.php @@ -0,0 +1,17 @@ + + * @license https://www.gnu.org/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link https://gnu.io/social + */ + +class NoticeSaveException extends ServerException +{ +} diff --git a/plugins/OStatus/lib/salmonaction.php b/plugins/OStatus/lib/salmonaction.php index 6855fd1b18..fad5d0cfe5 100644 --- a/plugins/OStatus/lib/salmonaction.php +++ b/plugins/OStatus/lib/salmonaction.php @@ -109,6 +109,8 @@ class SalmonAction extends Action // duplicate? Maybe someone's database is out of sync? // Let's just accept it and move on. common_log(LOG_INFO, 'Salmon slap carried an event which had already been fulfilled.'); + } catch (NoticeSaveException $e) { + common_debug('Notice::saveActivity did not save our '._ve($this->activity->verb).' activity, trying old-fashioned salmon saving.'); } try { -- 2.39.5