mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-26 07:20:57 +01:00
Bump Phabricator server version to 3
Summary: See D1257. Also make the error message more friendly, and remove a very very old Facebook-specific error. Test Plan: - Tried to diff with an older arc. - Tried to diff with a newer arc. - Diffed with the right arc. Reviewers: btrahan, jungejason, aran Reviewed By: aran CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D1258
This commit is contained in:
parent
9d8b5481ae
commit
f901befcf5
3 changed files with 43 additions and 11 deletions
|
@ -140,7 +140,11 @@ class PhabricatorConduitAPIController
|
||||||
} catch (ConduitException $ex) {
|
} catch (ConduitException $ex) {
|
||||||
$result = null;
|
$result = null;
|
||||||
$error_code = $ex->getMessage();
|
$error_code = $ex->getMessage();
|
||||||
$error_info = $method_handler->getErrorDescription($error_code);
|
if ($ex->getErrorDescription()) {
|
||||||
|
$error_info = $ex->getErrorDescription();
|
||||||
|
} else {
|
||||||
|
$error_info = $method_handler->getErrorDescription($error_code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($allow_unguarded_writes) {
|
if ($allow_unguarded_writes) {
|
||||||
unset($unguarded);
|
unset($unguarded);
|
||||||
|
|
|
@ -55,12 +55,6 @@ class ConduitAPI_conduit_connect_Method extends ConduitAPIMethod {
|
||||||
"Client/server version mismatch. Update your client.",
|
"Client/server version mismatch. Update your client.",
|
||||||
"ERR-UNKNOWN-CLIENT" =>
|
"ERR-UNKNOWN-CLIENT" =>
|
||||||
"Client is unknown.",
|
"Client is unknown.",
|
||||||
"ERR-UPDATE-ARC" =>
|
|
||||||
"Arcanist is now open source! Update your scripts/aliases to use ".
|
|
||||||
"'/home/engshare/devtools/arcanist/bin/arc' if you're running from ".
|
|
||||||
"a Facebook host, or see ".
|
|
||||||
"<http://www.intern.facebook.com/intern/wiki/index.php/Arcanist> for ".
|
|
||||||
"laptop instructions.",
|
|
||||||
"ERR-INVALID-USER" =>
|
"ERR-INVALID-USER" =>
|
||||||
"The username you are attempting to authenticate with is not valid.",
|
"The username you are attempting to authenticate with is not valid.",
|
||||||
"ERR-INVALID-CERTIFICATE" =>
|
"ERR-INVALID-CERTIFICATE" =>
|
||||||
|
@ -92,14 +86,23 @@ class ConduitAPI_conduit_connect_Method extends ConduitAPIMethod {
|
||||||
|
|
||||||
switch ($client) {
|
switch ($client) {
|
||||||
case 'arc':
|
case 'arc':
|
||||||
$server_version = 2;
|
$server_version = 3;
|
||||||
switch ($client_version) {
|
switch ($client_version) {
|
||||||
case 1:
|
|
||||||
throw new ConduitException('ERR-UPDATE-ARC');
|
|
||||||
case $server_version:
|
case $server_version:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new ConduitException('ERR-BAD-VERSION');
|
$ex = new ConduitException('ERR-BAD-VERSION');
|
||||||
|
|
||||||
|
if ($server_version < $client_version) {
|
||||||
|
$upgrade = "Upgrade your Phabricator install.";
|
||||||
|
} else {
|
||||||
|
$upgrade = "Upgrade your 'arc' client.";
|
||||||
|
}
|
||||||
|
|
||||||
|
$ex->setErrorDescription(
|
||||||
|
"Your 'arc' client version is '{$client_version}', but this ".
|
||||||
|
"server expects version '{$server_version}'. {$upgrade}");
|
||||||
|
throw $ex;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -20,4 +20,29 @@
|
||||||
* @group conduit
|
* @group conduit
|
||||||
*/
|
*/
|
||||||
class ConduitException extends Exception {
|
class ConduitException extends Exception {
|
||||||
|
|
||||||
|
private $errorDescription;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a detailed error description. If omitted, the generic error description
|
||||||
|
* will be used instead. This is useful to provide specific information about
|
||||||
|
* an exception (e.g., which values were wrong in an invalid request).
|
||||||
|
*
|
||||||
|
* @param string Detailed error description.
|
||||||
|
* @return this
|
||||||
|
*/
|
||||||
|
public function setErrorDescription($error_description) {
|
||||||
|
$this->errorDescription = $error_description;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a detailed error description, if available.
|
||||||
|
*
|
||||||
|
* @return string|null Error description, if one is available.
|
||||||
|
*/
|
||||||
|
public function getErrorDescription() {
|
||||||
|
return $this->errorDescription;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue