Start using NoParentNoticeException more widely

This commit is contained in:
Mikael Nordfeldth 2015-06-02 13:50:52 +02:00
parent c84b21008e
commit 0726dcd06c
5 changed files with 8 additions and 8 deletions

View File

@ -1311,7 +1311,7 @@ class Notice extends Managed_DataObject
$last = $parent; $last = $parent;
continue; continue;
} }
} catch (Exception $e) { } catch (NoParentNoticeException $e) {
// Latest notice has no parent // Latest notice has no parent
} }
// No parent, or parent out of scope // No parent, or parent out of scope
@ -1617,7 +1617,7 @@ class Notice extends Managed_DataObject
$this->saveReply($parentauthor->id); $this->saveReply($parentauthor->id);
$replied[$parentauthor->id] = 1; $replied[$parentauthor->id] = 1;
self::blow('reply:stream:%d', $parentauthor->id); self::blow('reply:stream:%d', $parentauthor->id);
} catch (Exception $e) { } catch (NoParentNoticeException $e) {
// Not a reply, since it has no parent! // Not a reply, since it has no parent!
} }
@ -1852,7 +1852,7 @@ class Notice extends Managed_DataObject
$reply = $this->getParent(); $reply = $this->getParent();
$ctx->replyToID = $reply->getUri(); $ctx->replyToID = $reply->getUri();
$ctx->replyToUrl = $reply->getUrl(); $ctx->replyToUrl = $reply->getUrl();
} catch (Exception $e) { } catch (NoParentNoticeException $e) {
// This is not a reply to something // This is not a reply to something
} }

View File

@ -328,7 +328,7 @@ class ApiAction extends Action
// different story for parenting. // different story for parenting.
$parent = $notice->getParent(); $parent = $notice->getParent();
$in_reply_to = $parent->id; $in_reply_to = $parent->id;
} catch (Exception $e) { } catch (NoParentNoticeException $e) {
$in_reply_to = null; $in_reply_to = null;
} }
$twitter_status['in_reply_to_status_id'] = $in_reply_to; $twitter_status['in_reply_to_status_id'] = $in_reply_to;

View File

@ -380,7 +380,7 @@ abstract class ImPlugin extends Plugin
$parent = $notice->getParent(); $parent = $notice->getParent();
$orig_profile = $parent->getProfile(); $orig_profile = $parent->getProfile();
$nicknames = sprintf('%1$s => %2$s', $profile->nickname, $orig_profile->nickname); $nicknames = sprintf('%1$s => %2$s', $profile->nickname, $orig_profile->nickname);
} catch (Exception $e) { } catch (NoParentNoticeException $e) {
$nicknames = $profile->nickname; $nicknames = $profile->nickname;
} }

View File

@ -725,8 +725,8 @@ function common_find_mentions($text, Notice $notice)
} }
} catch (NoProfileException $e) { } catch (NoProfileException $e) {
common_log(LOG_WARNING, sprintf('Notice %d author profile id %d does not exist', $origNotice->id, $origNotice->profile_id)); common_log(LOG_WARNING, sprintf('Notice %d author profile id %d does not exist', $origNotice->id, $origNotice->profile_id));
} catch (ServerException $e) { } catch (NoParentNoticeException $e) {
// Probably just no parent. Should get a specific NoParentException // This notice is not in reply to anything
} catch (Exception $e) { } catch (Exception $e) {
common_log(LOG_WARNING, __METHOD__ . ' got exception ' . get_class($e) . ' : ' . $e->getMessage()); common_log(LOG_WARNING, __METHOD__ . ' got exception ' . get_class($e) . ' : ' . $e->getMessage());
} }

View File

@ -354,7 +354,7 @@ class XmppPlugin extends ImPlugin
$xs->text(": "); $xs->text(": ");
} catch (InvalidUrlException $e) { } catch (InvalidUrlException $e) {
$xs->text(sprintf(' => %s', $orig_profile->nickname)); $xs->text(sprintf(' => %s', $orig_profile->nickname));
} catch (Exception $e) { } catch (NoParentNoticeException $e) {
$xs->text(": "); $xs->text(": ");
} }
if (!empty($notice->rendered)) { if (!empty($notice->rendered)) {