From d2c749c7de6b47c868f9886045bb5b701d938b60 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Mon, 19 May 2014 17:13:32 +0200 Subject: [PATCH] NoUriException added and implemented in FeedSub class This is a specific exception for objects which require URI but lack it, first implemented in FeedSub to allow for identification of bad entries. --- lib/nouriexception.php | 42 +++++++++++++++++++++++++++++ plugins/OStatus/classes/FeedSub.php | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 lib/nouriexception.php diff --git a/lib/nouriexception.php b/lib/nouriexception.php new file mode 100644 index 0000000000..95dae386e8 --- /dev/null +++ b/lib/nouriexception.php @@ -0,0 +1,42 @@ +. + * + * @category Exception + * @package GNUsocial + * @author Mikael Nordfeldth + * @copyright 2014 Free Software Foundation, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3 + * @link https://www.gnu.org/software/social/ + */ + +if (!defined('GNUSOCIAL')) { exit(1); } + +class NoUriException extends ServerException +{ + var $object = null; + + public function __construct(Managed_DataObject $object) + { + $this->object = $object; + $msg = get_class($object) . ' does not have a URI.'; + parent::__construct($msg); + } +} diff --git a/plugins/OStatus/classes/FeedSub.php b/plugins/OStatus/classes/FeedSub.php index cfbc36508b..9cf9a80911 100644 --- a/plugins/OStatus/classes/FeedSub.php +++ b/plugins/OStatus/classes/FeedSub.php @@ -103,7 +103,7 @@ class FeedSub extends Managed_DataObject public function getUri() { if (empty($this->uri)) { - throw new ServerException('No URI for FeedSub entry'); + throw new NoUriException($this); } return $this->uri; }