summaryrefslogtreecommitdiff
path: root/plugins/OStatus/classes
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-03-03 18:23:28 -0800
committerBrion Vibber <brion@pobox.com>2010-03-03 18:23:28 -0800
commita4d9171306a06983094fdc90dbf040335c4f803f (patch)
tree1d9d7d4e88f35e7bacfa8f7d5ad82d2ee441f6ad /plugins/OStatus/classes
parent6a5a629afac881fdc8369dfef2924f7f62949fab (diff)
Fix up catching of webfinger setup fails
Diffstat (limited to 'plugins/OStatus/classes')
-rw-r--r--plugins/OStatus/classes/Ostatus_profile.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php
index 7ab031aa5..b3b4336b5 100644
--- a/plugins/OStatus/classes/Ostatus_profile.php
+++ b/plugins/OStatus/classes/Ostatus_profile.php
@@ -1267,6 +1267,11 @@ class Ostatus_profile extends Memcached_DataObject
}
}
+ /**
+ * @param string $addr webfinger address
+ * @return Ostatus_profile
+ * @throws Exception on error conditions
+ */
public static function ensureWebfinger($addr)
{
// First, try the cache
@@ -1275,7 +1280,8 @@ class Ostatus_profile extends Memcached_DataObject
if ($uri !== false) {
if (is_null($uri)) {
- return null;
+ // Negative cache entry
+ throw new Exception('Not a valid webfinger address.');
}
$oprofile = Ostatus_profile::staticGet('uri', $uri);
if (!empty($oprofile)) {
@@ -1299,8 +1305,9 @@ class Ostatus_profile extends Memcached_DataObject
try {
$result = $disco->lookup($addr);
} catch (Exception $e) {
+ // Save negative cache entry so we don't waste time looking it up again.
self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), null);
- return null;
+ throw new Exception('Not a valid webfinger address.');
}
foreach ($result->links as $link) {
@@ -1410,7 +1417,7 @@ class Ostatus_profile extends Memcached_DataObject
return $oprofile;
}
- return null;
+ throw new Exception("Couldn't find a valid profile for '$addr'");
}
function saveHTMLFile($title, $rendered)