X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FConsole%2FContact.php;h=11f7f87ced01f35045b1803d7061d826e34981e8;hb=77906627c5bb57d404d40702f89c205d1faa9542;hp=9dfcf1392555545137d4b2c8bf91f089661bbbc2;hpb=3ad6536fd076182611030a894bec5bd122949fdc;p=friendica.git diff --git a/src/Console/Contact.php b/src/Console/Contact.php index 9dfcf13925..11f7f87ced 100644 --- a/src/Console/Contact.php +++ b/src/Console/Contact.php @@ -1,6 +1,6 @@ getArgument(1); if (empty($cid)) { @@ -199,13 +201,23 @@ HELP; $user = UserModel::getById($contact['uid']); - $result = ContactModel::terminateFriendship($user, $contact); + try { + $result = ContactModel::terminateFriendship($user, $contact); + if ($result === false) { + throw new RuntimeException('Unable to unfollow this contact, please retry in a few minutes or check the logs.'); + } + + $this->out('Contact was successfully unfollowed'); + + return true; + } catch (\Exception $e) { + DI::logger()->error($e->getMessage(), ['owner' => $user, 'contact' => $contact]); + throw new RuntimeException('Unable to unfollow this contact, please check the log'); + } } /** * Marks a contact for removal - * - * @return bool True, if the command was successful */ private function removeContact() { @@ -218,7 +230,7 @@ HELP; } } - $result = ContactModel::remove($cid); + ContactModel::remove($cid); } /**