]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
push exception on missing profile down to Notice::getProfile()
authorEvan Prodromou <evan@status.net>
Tue, 13 Jul 2010 14:51:25 +0000 (10:51 -0400)
committerEvan Prodromou <evan@status.net>
Tue, 13 Jul 2010 14:51:25 +0000 (10:51 -0400)
classes/Notice.php
lib/apiaction.php

index 482bc550b9d093880d2d181b4355e6b9bfab3549..ae7e2e54022a2c27e3740b7549b78cfaf4c976a7 100644 (file)
@@ -90,7 +90,13 @@ class Notice extends Memcached_DataObject
 
     function getProfile()
     {
-        return Profile::staticGet('id', $this->profile_id);
+        $profile = Profile::staticGet('id', $this->profile_id);
+
+        if (empty($profile)) {
+            throw new ServerException(sprintf(_('No such profile (%d) for notice (%d)'), $this->profile_id, $this->id));
+        }
+
+        return $profile;
     }
 
     function delete()
index 16dd878142cd2c0482df0498af998c74aea9b365..01985f0db3d7f5e36093182802aefcb736fc295e 100644 (file)
@@ -462,10 +462,6 @@ class ApiAction extends Action
     {
         $profile = $notice->getProfile();
 
-        if (empty($profile)) {
-            throw new ServerException(sprintf(_('No such profile: %d'), $notice->profile_id));
-        }
-
         $entry = array();
 
         // We trim() to avoid extraneous whitespace in the output
@@ -798,7 +794,7 @@ class ApiAction extends Action
                     $entry = $this->twitterRssEntryArray($n);
                     $this->showTwitterRssItem($entry);
                 } catch (Exception $e) {
-                    common_log(LOG_ERR, "Error with notice {$n->id}: " . $e->getMessage());
+                    common_log(LOG_ERR, $e->getMessage());
                     // continue on exceptions
                 }
             }
@@ -808,7 +804,7 @@ class ApiAction extends Action
                     $entry = $this->twitterRssEntryArray($notice);
                     $this->showTwitterRssItem($entry);
                 } catch (Exception $e) {
-                    common_log(LOG_ERR,  "Error with notice {$n->id}: " . $e->getMessage());
+                    common_log(LOG_ERR, $e->getMessage());
                     // continue on exceptions
                 }
             }