mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 06:42:41 +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:
parent
182e260472
commit
a30a9a8353
1 changed files with 12 additions and 1 deletions
|
@ -191,6 +191,16 @@ try {
|
||||||
$user_name = idx($host_config, 'user');
|
$user_name = idx($host_config, 'user');
|
||||||
$certificate = idx($host_config, 'cert');
|
$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);
|
$description = implode(' ', $argv);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -204,7 +214,8 @@ try {
|
||||||
'certificate' => $certificate,
|
'certificate' => $certificate,
|
||||||
));
|
));
|
||||||
} catch (ConduitClientException $ex) {
|
} catch (ConduitClientException $ex) {
|
||||||
if ($ex->getErrorCode() == 'ERR-NO-CERTIFICATE') {
|
if ($ex->getErrorCode() == 'ERR-NO-CERTIFICATE' ||
|
||||||
|
$ex->getErrorCode() == 'ERR-INVALID-USER') {
|
||||||
$message =
|
$message =
|
||||||
"\n".
|
"\n".
|
||||||
phutil_console_format(
|
phutil_console_format(
|
||||||
|
|
Loading…
Reference in a new issue