summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-07-13 10:42:06 -0400
committerEvan Prodromou <evan@status.net>2010-07-13 10:42:06 -0400
commitab149755b62aaf7959a97e4a425e20aebf4c92cc (patch)
tree4bd0c79f0bb567f3fddff148aed1220d950e44be /lib
parent1339f1f908acf2ad69928494f7dfc5c09c5fb211 (diff)
handle notices without profiles better in RSS output
Diffstat (limited to 'lib')
-rw-r--r--lib/apiaction.php23
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/apiaction.php b/lib/apiaction.php
index 8de13a62d..16dd87814 100644
--- a/lib/apiaction.php
+++ b/lib/apiaction.php
@@ -461,6 +461,11 @@ class ApiAction extends Action
function twitterRssEntryArray($notice)
{
$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
@@ -789,13 +794,23 @@ class ApiAction extends Action
if (is_array($notice)) {
foreach ($notice as $n) {
- $entry = $this->twitterRssEntryArray($n);
- $this->showTwitterRssItem($entry);
+ try {
+ $entry = $this->twitterRssEntryArray($n);
+ $this->showTwitterRssItem($entry);
+ } catch (Exception $e) {
+ common_log(LOG_ERR, "Error with notice {$n->id}: " . $e->getMessage());
+ // continue on exceptions
+ }
}
} else {
while ($notice->fetch()) {
- $entry = $this->twitterRssEntryArray($notice);
- $this->showTwitterRssItem($entry);
+ try {
+ $entry = $this->twitterRssEntryArray($notice);
+ $this->showTwitterRssItem($entry);
+ } catch (Exception $e) {
+ common_log(LOG_ERR, "Error with notice {$n->id}: " . $e->getMessage());
+ // continue on exceptions
+ }
}
}