From 835e70dbe2d68e8263affe8aa538f8b5cba25c5f Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Mon, 15 Feb 2016 16:59:49 +0100 Subject: [PATCH] throw exception if we don't find a token for a given server --- apps/federation/lib/dbhandler.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/federation/lib/dbhandler.php b/apps/federation/lib/dbhandler.php index 9e44c72cc4..3ea84baa3e 100644 --- a/apps/federation/lib/dbhandler.php +++ b/apps/federation/lib/dbhandler.php @@ -156,6 +156,7 @@ class DbHandler { * * @param string $url * @return string + * @throws \Exception */ public function getToken($url) { $hash = $this->hash($url); @@ -165,6 +166,11 @@ class DbHandler { ->setParameter('url_hash', $hash); $result = $query->execute()->fetch(); + + if (!isset($result['token'])) { + throw new \Exception('No token found for: ' . $url); + } + return $result['token']; }