1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-29 10:12:41 +01:00

Improve error handling in arc install-certificate

Summary: Fixes T9858. Reasonable typos and misunderstandings currently produce very confusing error messages.

Test Plan:
```
$ arc install certificate
Usage Exception: Server URI "certificate" must include a protocol and domain. It should be in the form "https://phabricator.example.com/".
```

  - Also used a good URI.
  - Also used no URI.

Reviewers: joshuaspence, chad

Reviewed By: chad

Maniphest Tasks: T9858

Differential Revision: https://secure.phabricator.com/D14577
This commit is contained in:
epriestley 2015-11-27 08:35:17 -08:00
parent eeaa176cfc
commit 4f1141d0c5

View file

@ -56,9 +56,11 @@ EOTEXT
$config = $configuration_manager->readUserConfigurationFile(); $config = $configuration_manager->readUserConfigurationFile();
$console->writeOut( $this->writeInfo(
"%s\n", pht('CONNECT'),
pht('Trying to connect to server...')); pht(
'Connecting to "%s"...',
$uri));
$conduit = $this->establishConduit()->getConduit(); $conduit = $this->establishConduit()->getConduit();
try { try {
@ -194,10 +196,19 @@ EOTEXT
$uri = $conduit_uri; $uri = $conduit_uri;
} }
$uri = new PhutilURI($uri); $uri_object = new PhutilURI($uri);
$uri->setPath('/api/'); if (!$uri_object->getProtocol() || !$uri_object->getDomain()) {
throw new ArcanistUsageException(
pht(
'Server URI "%s" must include a protocol and domain. It should be '.
'in the form "%s".',
$uri,
'https://phabricator.example.com/'));
}
return (string)$uri; $uri_object->setPath('/api/');
return (string)$uri_object;
} }
} }