adding some exception handling for magicenv parsing
This commit is contained in:
parent
bac959ad46
commit
e62e49ed3b
@ -59,7 +59,7 @@ class MagicEnvelope
|
|||||||
$signer_uri = $this->normalizeUser($signer_uri);
|
$signer_uri = $this->normalizeUser($signer_uri);
|
||||||
|
|
||||||
if (!$this->checkAuthor($text, $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));
|
$signature_alg = Magicsig::fromString($this->getKeyPair($signer_uri));
|
||||||
|
@ -72,8 +72,12 @@ class Salmon
|
|||||||
// TODO: Should probably be getting the signer uri as an argument?
|
// TODO: Should probably be getting the signer uri as an argument?
|
||||||
$signer_uri = $magic_env->getAuthor($text);
|
$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);
|
return $magic_env->unfold($env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user