mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-26 08:42:40 +01:00
Make arc patch show the superior error message if you are not authenticated
Summary: ...by making requireAuthentication return true if conduit is required. Test Plan: mv ~/.arcrc ~/.arcrcbak; arc patch D12121; <verify error message> Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1522 Differential Revision: https://secure.phabricator.com/D3014
This commit is contained in:
parent
5be656aa57
commit
333bb09e04
1 changed files with 19 additions and 15 deletions
|
@ -265,24 +265,28 @@ abstract class ArcanistBaseWorkflow {
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->establishConduit();
|
$this->establishConduit();
|
||||||
|
|
||||||
$credentials = $this->conduitCredentials;
|
$credentials = $this->conduitCredentials;
|
||||||
|
|
||||||
|
try {
|
||||||
if (!$credentials) {
|
if (!$credentials) {
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
"Set conduit credentials with setConduitCredentials() before ".
|
"Set conduit credentials with setConduitCredentials() before ".
|
||||||
"authenticating conduit!");
|
"authenticating conduit!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($credentials['user']) || empty($credentials['certificate'])) {
|
if (empty($credentials['user'])) {
|
||||||
throw new Exception(
|
throw new ConduitClientException('ERR-INVALID-USER',
|
||||||
"Credentials must include a 'user' and a 'certificate'.");
|
'Empty user in credentials.');
|
||||||
|
}
|
||||||
|
if (empty($credentials['certificate'])) {
|
||||||
|
throw new ConduitClientException('ERR-NO-CERTIFICATE',
|
||||||
|
'Empty certificate in credentials.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$description = idx($credentials, 'description', '');
|
$description = idx($credentials, 'description', '');
|
||||||
$user = $credentials['user'];
|
$user = $credentials['user'];
|
||||||
$certificate = $credentials['certificate'];
|
$certificate = $credentials['certificate'];
|
||||||
|
|
||||||
try {
|
|
||||||
$connection = $this->getConduit()->callMethodSynchronous(
|
$connection = $this->getConduit()->callMethodSynchronous(
|
||||||
'conduit.connect',
|
'conduit.connect',
|
||||||
array(
|
array(
|
||||||
|
|
Loading…
Reference in a new issue