forked from GNUsocial/gnu-social
push exception on missing profile down to Notice::getProfile()
This commit is contained in:
parent
ab149755b6
commit
dfd65a4290
@ -90,7 +90,13 @@ class Notice extends Memcached_DataObject
|
|||||||
|
|
||||||
function getProfile()
|
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()
|
function delete()
|
||||||
|
@ -462,10 +462,6 @@ class ApiAction extends Action
|
|||||||
{
|
{
|
||||||
$profile = $notice->getProfile();
|
$profile = $notice->getProfile();
|
||||||
|
|
||||||
if (empty($profile)) {
|
|
||||||
throw new ServerException(sprintf(_('No such profile: %d'), $notice->profile_id));
|
|
||||||
}
|
|
||||||
|
|
||||||
$entry = array();
|
$entry = array();
|
||||||
|
|
||||||
// We trim() to avoid extraneous whitespace in the output
|
// We trim() to avoid extraneous whitespace in the output
|
||||||
@ -798,7 +794,7 @@ class ApiAction extends Action
|
|||||||
$entry = $this->twitterRssEntryArray($n);
|
$entry = $this->twitterRssEntryArray($n);
|
||||||
$this->showTwitterRssItem($entry);
|
$this->showTwitterRssItem($entry);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
common_log(LOG_ERR, "Error with notice {$n->id}: " . $e->getMessage());
|
common_log(LOG_ERR, $e->getMessage());
|
||||||
// continue on exceptions
|
// continue on exceptions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -808,7 +804,7 @@ class ApiAction extends Action
|
|||||||
$entry = $this->twitterRssEntryArray($notice);
|
$entry = $this->twitterRssEntryArray($notice);
|
||||||
$this->showTwitterRssItem($entry);
|
$this->showTwitterRssItem($entry);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
common_log(LOG_ERR, "Error with notice {$n->id}: " . $e->getMessage());
|
common_log(LOG_ERR, $e->getMessage());
|
||||||
// continue on exceptions
|
// continue on exceptions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user