]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Distinguish notice saving errors from others for Salmon
authorMikael Nordfeldth <mmn@hethane.se>
Sat, 16 Jan 2016 21:36:42 +0000 (22:36 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Sat, 16 Jan 2016 21:39:04 +0000 (22:39 +0100)
classes/Notice.php
lib/noticesaveexception.php [new file with mode: 0644]
plugins/OStatus/lib/salmonaction.php

index 963b24ba5e3289a39eb20be49801fa0794ba5ba5..523c60999144822b17118584fe68b0e3255d085f 100644 (file)
@@ -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 (file)
index 0000000..2e34a1a
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+
+if (!defined('GNUSOCIAL')) { exit(1); }
+
+/**
+ * Base exception class for when a notice cannot be saved
+ *
+ * @category Exception
+ * @package  GNUsocial
+ * @author   Mikael Nordfeldth <mmn@hethane.se>
+ * @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
+{
+}
index 6855fd1b180af27c9a2de155503fab2451c0df48..fad5d0cfe51dbbffb1bf124d3157f0f8b031a585 100644 (file)
@@ -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 {