error handling

This commit is contained in:
Alexander Schäferdiek 2016-07-10 21:12:46 +02:00
parent 9f085ca304
commit 1840592c1b
2 changed files with 3 additions and 3 deletions

View file

@ -61,7 +61,7 @@ final class DeleteAction
$curl->delete(getenv('xmpp_curl_uri') . '/user/' . $username);
$curl->close();
if ($curl->http_status_code == 200) {
if ($curl->http_status_code == 200 || $curl->http_status_code == 404) {
$userRegistered->delete();
$this->flash->addMessage('success', $this->translator->trans('delete.flash.success', ['%username%' => $username, '%server%' => getenv('site_xmpp_server_displayname')]));
@ -69,7 +69,7 @@ final class DeleteAction
return $response->withRedirect('/');
} else {
$this->flash->addMessage('error', $this->translator->trans('delete.flash.unknown_error', ['%username%' => $username]));
$this->logger->warning($this->translator->trans('log.delete.flash.unknown_error'), ['code' => $curl->http_status_code, 'message' => $curl->http_error_message]);
$this->logger->error($this->translator->trans('log.delete.flash.unknown_error'), ['username' => $username, 'code' => $curl->http_status_code, 'message' => $curl->http_error_message]);
return $response->withRedirect('/delete');
}
}

View file

@ -97,7 +97,7 @@ final class VerificationAction
return $response->withRedirect('/');
} else {
$this->flash->addMessage('error', $this->translator->trans('verification.flash.unknown_error', ['%username%' => $userAwaiting->username]));
$this->logger->warning($this->translator->trans('verification.flash.unknown_error'), ['code' => $curl->http_status_code, 'message' => $curl->http_error_message]);
$this->logger->warning($this->translator->trans('verification.flash.unknown_error'), ['username' => $userAwaiting->username, 'code' => $curl->http_status_code, 'message' => $curl->http_error_message]);
return $response->withRedirect('/');
}
}