From 5a2833c5aa98a4a11e365f51b32cb022889c6bda Mon Sep 17 00:00:00 2001 From: joyqi Date: Fri, 3 Sep 2021 12:22:22 +0800 Subject: [PATCH] fix xmlrpc --- var/Widget/XmlRpc.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/var/Widget/XmlRpc.php b/var/Widget/XmlRpc.php index b4992252..6ff58900 100644 --- a/var/Widget/XmlRpc.php +++ b/var/Widget/XmlRpc.php @@ -932,19 +932,20 @@ class XmlRpc extends Contents implements ActionInterface, Hook * @param string $userName * @param string $password * @param integer $commentId - * @return array|Error + * @return array + * @throws Exception */ - public function wpGetComment(int $blogId, string $userName, string $password, int $commentId) + public function wpGetComment(int $blogId, string $userName, string $password, int $commentId): array { $comment = CommentsEdit::alloc(null, ['coid' => $commentId], false); $comment->getComment(); if (!$comment->have()) { - return new Error(404, _t('评论不存在')); + throw new Exception(_t('评论不存在'), 404); } if (!$comment->commentIsWriteable()) { - return new Error(403, _t('没有获取评论的权限')); + throw new Exception(_t('没有获取评论的权限'), 403); } return [