1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 16:22:42 +01:00

Improve workflow for missing certificates.

This commit is contained in:
epriestley 2011-04-10 13:09:31 -07:00
parent 0472a5ff95
commit d87fda8561

View file

@ -190,17 +190,28 @@ try {
)); ));
} catch (ConduitClientException $ex) { } catch (ConduitClientException $ex) {
if ($ex->getErrorCode() == 'ERR-NO-CERTIFICATE') { if ($ex->getErrorCode() == 'ERR-NO-CERTIFICATE') {
$no_cert_msg = "You don't have certificate for ".$conduit_uri.".\n"; $message =
"\n\n".
phutil_console_format(
"YOU NEED TO __INSTALL A CERTIFICATE__ TO LOGIN TO PHABRICATOR").
"\n\n".
"The server '{$conduit_uri}' rejected your request:".
"\n\n".
$ex->getMessage().
"\n\n";
$hosts_with_cert = ifilter($hosts_config, 'cert'); $hosts_with_cert = ifilter($hosts_config, 'cert');
if (!empty($hosts_with_cert)) { if (!empty($hosts_with_cert)) {
$no_cert_msg .= 'You have certificate(s) for '. if (count($hosts_with_cert) == 1) {
implode(array_keys($hosts_with_cert), ', ').".\n"; $message .=
"You currently have a certificate installed for one host:\n\n";
} else {
$message .=
"You currently have certificates installed for these hosts:\n\n";
} }
$no_cert_msg .= 'Please refer to page http://www.phabricator.com'. $message .= ' '.implode("\n ", array_keys($hosts_with_cert));
'/docs/phabricator/article/Installing_Arcanist_Certificates.html '. $message .= "\n";
'for more info.'; }
throw new ArcanistUsageException($no_cert_msg); throw new ArcanistUsageException($message);
} else { } else {
throw $ex; throw $ex;
} }