]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
adding some exception handling for magicenv parsing
authorJames Walker <walkah@walkah.net>
Thu, 25 Feb 2010 14:39:16 +0000 (09:39 -0500)
committerJames Walker <walkah@walkah.net>
Thu, 25 Feb 2010 22:09:54 +0000 (17:09 -0500)
plugins/OStatus/lib/magicenvelope.php
plugins/OStatus/lib/salmon.php

index 81f4609c5cd94a138ab795381486c967f0e00913..4a9efe93d1c83f76132e4e2dc6c094ecad59b537 100644 (file)
@@ -59,7 +59,7 @@ class MagicEnvelope
         $signer_uri = $this->normalizeUser($signer_uri);
 
         if (!$this->checkAuthor($text, $signer_uri)) {
-            return false;
+            throw new Exception("Unable to determine entry author.");
         }
 
         $signature_alg = Magicsig::fromString($this->getKeyPair($signer_uri));
index b5f178cc6a2e4cec2f191dad33d96ed39aa9a4ad..9d4359f74f5e5c875b7faabd6d7a823bdeb7f013 100644 (file)
@@ -72,8 +72,12 @@ class Salmon
         // TODO: Should probably be getting the signer uri as an argument?
         $signer_uri = $magic_env->getAuthor($text);
 
-        $env = $magic_env->signMessage($text, 'application/atom+xml', $signer_uri);
-
+        try {
+            $env = $magic_env->signMessage($text, 'application/atom+xml', $signer_uri);
+        } catch (Exception $e) {
+            common_log(LOG_ERR, "Salmon signing failed: ". $e->getMessage());
+            return $text;
+        }
         return $magic_env->unfold($env);
     }