1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-09 16:32:39 +01:00

Give users meaningful error messages for missing 'arc' credentials

Summary:
We give you a worthless message that doesn't point at "arc install-certificate"
if you don't have an .arcrc right now. Instead, tell the user to run "arc
install-certificate".

Test Plan:
Nuked my ~/.arcrc and tried to run "arc list".

Reviewed By: llorca
Reviewers: codeblock, llorca, jungejason, aran, tuomaspelkonen
CC: aran, llorca
Differential Revision: 538
This commit is contained in:
epriestley 2011-06-26 20:43:24 -07:00
parent 182e260472
commit a30a9a8353

View file

@ -191,6 +191,16 @@ try {
$user_name = idx($host_config, 'user');
$certificate = idx($host_config, 'cert');
if (!$user_name || !$certificate) {
throw new ArcanistUsageException(
phutil_console_format(
"YOU NEED TO __INSTALL A CERTIFICATE__ TO LOGIN TO PHABRICATOR\n\n".
"You are trying to connect to '{$conduit_uri}' but do not have ".
"a certificate installed for this host. Run:\n\n".
" $ **arc install-certificate**\n\n".
"...to install one."));
}
$description = implode(' ', $argv);
try {
@ -204,7 +214,8 @@ try {
'certificate' => $certificate,
));
} catch (ConduitClientException $ex) {
if ($ex->getErrorCode() == 'ERR-NO-CERTIFICATE') {
if ($ex->getErrorCode() == 'ERR-NO-CERTIFICATE' ||
$ex->getErrorCode() == 'ERR-INVALID-USER') {
$message =
"\n".
phutil_console_format(