]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Proper HTTP status codes for WebFinger search miss
authorMikael Nordfeldth <mmn@hethane.se>
Wed, 4 Jun 2014 10:59:42 +0000 (12:59 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Wed, 4 Jun 2014 10:59:58 +0000 (12:59 +0200)
plugins/WebFinger/actions/webfinger.php

index d02eaa46d992693057202ddaba9c1fd27efc6d29..534f70bf8fbae4364025b06b4ac7156a2800780c 100644 (file)
@@ -36,12 +36,17 @@ class WebfingerAction extends XrdAction
         // throws exception if resource is empty
         $this->resource = Discovery::normalize($this->trimmed('resource'));
 
-        if (Event::handle('StartGetWebFingerResource', array($this->resource, &$this->target, $this->args))) {
-            Event::handle('EndGetWebFingerResource', array($this->resource, &$this->target, $this->args));
+        try {
+            if (Event::handle('StartGetWebFingerResource', array($this->resource, &$this->target, $this->args))) {
+                Event::handle('EndGetWebFingerResource', array($this->resource, &$this->target, $this->args));
+            }
+        } catch (NoSuchUserException $e) {
+            throw new ServerException($e->getMessage(), 404);
         }
 
         if (!$this->target instanceof WebFingerResource) {
-            throw new ServerException('Resource not found in local database.', 404);
+            // TRANS: Error message when an object URI which we cannot find was requested
+            throw new ServerException(_m('Resource not found in local database.'), 404);
         }
 
         return true;