mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-25 23:10: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
src/applications/conduit
controller/api
method/conduit/connect
protocol/exception
|
@ -140,7 +140,11 @@ class PhabricatorConduitAPIController
|
|||
} catch (ConduitException $ex) {
|
||||
$result = null;
|
||||
$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) {
|
||||
unset($unguarded);
|
||||
|
|
|
@ -55,12 +55,6 @@ class ConduitAPI_conduit_connect_Method extends ConduitAPIMethod {
|
|||
"Client/server version mismatch. Update your client.",
|
||||
"ERR-UNKNOWN-CLIENT" =>
|
||||
"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" =>
|
||||
"The username you are attempting to authenticate with is not valid.",
|
||||
"ERR-INVALID-CERTIFICATE" =>
|
||||
|
@ -92,14 +86,23 @@ class ConduitAPI_conduit_connect_Method extends ConduitAPIMethod {
|
|||
|
||||
switch ($client) {
|
||||
case 'arc':
|
||||
$server_version = 2;
|
||||
$server_version = 3;
|
||||
switch ($client_version) {
|
||||
case 1:
|
||||
throw new ConduitException('ERR-UPDATE-ARC');
|
||||
case $server_version:
|
||||
break;
|
||||
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;
|
||||
default:
|
||||
|
|
|
@ -20,4 +20,29 @@
|
|||
* @group conduit
|
||||
*/
|
||||
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