From ad24456a96a6edfbce05098ce71b0a07084a80b0 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Wed, 5 Feb 2014 09:10:53 -0800 Subject: [PATCH] Don't throw exceptions in the Echo formatter Bug: 60906 Change-Id: I16b654666013a2120764ed3fdb5194ee3d286c9a --- includes/Notifications/Formatter.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/includes/Notifications/Formatter.php b/includes/Notifications/Formatter.php index 255c45b..f421aa6 100644 --- a/includes/Notifications/Formatter.php +++ b/includes/Notifications/Formatter.php @@ -5,6 +5,7 @@ namespace Flow; use Flow\Container; use Flow\UrlGenerator; use EchoBasicFormatter; +use Flow\Exception\InvalidInputException; // could be renamed later if we have more formatters class NotificationFormatter extends EchoBasicFormatter { @@ -86,7 +87,12 @@ class NotificationFormatter extends EchoBasicFormatter { $post = $event->getExtraParam( 'post-id' ); $flow = $event->getExtraParam( 'topic-workflow' ); if ( $post && $flow && $title ) { - list( $target, $query ) = $urlGenerator->generateUrlData( $flow ); + try { + list( $target, $query ) = $urlGenerator->generateUrlData( $flow ); + } catch ( InvalidInputException $e ) { + // @FIXME can't throw an exception here bug 60906 + } + // Take user to the post if there is only one target post, // otherwise, take user to the topic view if ( $this->bundleData['raw-data-count'] <= 1 ) { @@ -102,8 +108,11 @@ class NotificationFormatter extends EchoBasicFormatter { case 'flow-topic': $topic = $event->getExtraParam( 'topic-workflow' ); - list( $target, $query ) = - $urlGenerator->generateUrlData( $topic ); + try { + list( $target, $query ) = $urlGenerator->generateUrlData( $topic ); + } catch ( InvalidInputException $e ) { + // @FIXME can't throw an exception here bug 60906 + } break; default: return parent::getLinkParams( $event, $user, $destination ); -- 1.8.5.3