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

Improve the error message for ERR-NO-CERTIFICATE

Summary:
list the hosts for which the .arcrc file have certificate and
which conduit-uri the user is trying to access.

Test Plan:
test the case where a cert is missing.

Reviewed By: epriestley
CC: epriestley
Differential Revision: 76
This commit is contained in:
jungejason 2011-03-16 15:17:07 -07:00
parent bdde006484
commit 51b371481b

View file

@ -166,6 +166,8 @@ try {
$certificate = idx($host_config, 'cert'); $certificate = idx($host_config, 'cert');
$description = implode(' ', $argv); $description = implode(' ', $argv);
try {
$connection = $conduit->callMethodSynchronous( $connection = $conduit->callMethodSynchronous(
'conduit.connect', 'conduit.connect',
array( array(
@ -175,6 +177,23 @@ try {
'user' => $user_name, 'user' => $user_name,
'certificate' => $certificate, 'certificate' => $certificate,
)); ));
} catch (ConduitClientException $ex) {
if ($ex->getErrorCode() == 'ERR-NO-CERTIFICATE') {
$no_cert_msg = "You don't have certificate for ".$conduit_uri.".\n";
$hosts_with_cert = ifilter($hosts_config, 'cert');
if (!empty($hosts_with_cert)) {
$no_cert_msg .= 'You have certificate(s) for '.
implode(array_keys($hosts_with_cert), ', ').".\n";
}
$no_cert_msg .= 'Please refer to page http://www.phabricator.com'.
'/docs/phabricator/article/Installing_Arcanist_Certificates.html '.
'for more info.';
throw new ArcanistUsageException($no_cert_msg);
} else {
throw $ex;
}
}
$workflow->setUserName($user_name); $workflow->setUserName($user_name);
$user_phid = idx($connection, 'userPHID'); $user_phid = idx($connection, 'userPHID');