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

Replace ReleephFieldSpecificationIncompleteException with the CustomField version

Summary: Ref T3718. Releeph has a custom implementation of this exception; a more general version exists in CustomField. Use the more general one. Nothing catches the specific one.

Test Plan: `grep`

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T3718

Differential Revision: https://secure.phabricator.com/D6782
This commit is contained in:
epriestley 2013-08-20 09:44:38 -07:00
parent 686d2f87af
commit 7b2ab80c66
4 changed files with 6 additions and 26 deletions

View file

@ -1964,7 +1964,6 @@ phutil_register_library_map(array(
'ReleephFieldParseException' => 'applications/releeph/field/exception/ReleephFieldParseException.php', 'ReleephFieldParseException' => 'applications/releeph/field/exception/ReleephFieldParseException.php',
'ReleephFieldSelector' => 'applications/releeph/field/selector/ReleephFieldSelector.php', 'ReleephFieldSelector' => 'applications/releeph/field/selector/ReleephFieldSelector.php',
'ReleephFieldSpecification' => 'applications/releeph/field/specification/ReleephFieldSpecification.php', 'ReleephFieldSpecification' => 'applications/releeph/field/specification/ReleephFieldSpecification.php',
'ReleephFieldSpecificationIncompleteException' => 'applications/releeph/field/exception/ReleephFieldSpecificationIncompleteException.php',
'ReleephIntentFieldSpecification' => 'applications/releeph/field/specification/ReleephIntentFieldSpecification.php', 'ReleephIntentFieldSpecification' => 'applications/releeph/field/specification/ReleephIntentFieldSpecification.php',
'ReleephLevelFieldSpecification' => 'applications/releeph/field/specification/ReleephLevelFieldSpecification.php', 'ReleephLevelFieldSpecification' => 'applications/releeph/field/specification/ReleephLevelFieldSpecification.php',
'ReleephOriginalCommitFieldSpecification' => 'applications/releeph/field/specification/ReleephOriginalCommitFieldSpecification.php', 'ReleephOriginalCommitFieldSpecification' => 'applications/releeph/field/specification/ReleephOriginalCommitFieldSpecification.php',
@ -4149,7 +4148,6 @@ phutil_register_library_map(array(
0 => 'PhabricatorCustomField', 0 => 'PhabricatorCustomField',
1 => 'PhabricatorMarkupInterface', 1 => 'PhabricatorMarkupInterface',
), ),
'ReleephFieldSpecificationIncompleteException' => 'Exception',
'ReleephIntentFieldSpecification' => 'ReleephFieldSpecification', 'ReleephIntentFieldSpecification' => 'ReleephFieldSpecification',
'ReleephLevelFieldSpecification' => 'ReleephFieldSpecification', 'ReleephLevelFieldSpecification' => 'ReleephFieldSpecification',
'ReleephOriginalCommitFieldSpecification' => 'ReleephFieldSpecification', 'ReleephOriginalCommitFieldSpecification' => 'ReleephFieldSpecification',

View file

@ -1,11 +0,0 @@
<?php
final class ReleephFieldSpecificationIncompleteException extends Exception {
public function __construct(ReleephFieldSpecification $field) {
$class = get_class($field);
parent::__construct(
"Releeph field class {$class} is incompletely implemented.");
}
}

View file

@ -24,7 +24,7 @@ abstract class ReleephFieldSpecification
public function getRequiredStorageKey() { public function getRequiredStorageKey() {
$key = $this->getStorageKey(); $key = $this->getStorageKey();
if ($key === null) { if ($key === null) {
throw new ReleephFieldSpecificationIncompleteException($this); throw new PhabricatorCustomFieldImplementationIncompleteException($this);
} }
if (strpos($key, '.') !== false) { if (strpos($key, '.') !== false) {
/** /**
@ -176,11 +176,11 @@ abstract class ReleephFieldSpecification
} }
public function renderLabelForCommitMessage() { public function renderLabelForCommitMessage() {
throw new ReleephFieldSpecificationIncompleteException($this); throw new PhabricatorCustomFieldImplementationIncompleteException($this);
} }
public function renderValueForCommitMessage() { public function renderValueForCommitMessage() {
throw new ReleephFieldSpecificationIncompleteException($this); throw new PhabricatorCustomFieldImplementationIncompleteException($this);
} }
public function shouldAppearOnRevertMessage() { public function shouldAppearOnRevertMessage() {
@ -215,7 +215,7 @@ abstract class ReleephFieldSpecification
} }
public function getMarkupText($field) { public function getMarkupText($field) {
throw new ReleephFieldSpecificationIncompleteException($this); throw new PhabricatorCustomFieldImplementationIncompleteException($this);
} }
final public function getMarkupEngineOutput() { final public function getMarkupEngineOutput() {

View file

@ -20,10 +20,7 @@ abstract class ReleephLevelFieldSpecification
abstract public function getDescriptionForLevel($level); abstract public function getDescriptionForLevel($level);
public function getStorageKey() { public function getStorageKey() {
$class = get_class($this); throw new PhabricatorCustomFieldImplementationIncompleteException($this);
throw new ReleephFieldSpecificationIncompleteException(
$this,
"You must implement getStorageKey() for children of {$class}!");
} }
public function renderValueForHeaderView() { public function renderValueForHeaderView() {
@ -34,11 +31,7 @@ abstract class ReleephLevelFieldSpecification
$control_name = $this->getRequiredStorageKey(); $control_name = $this->getRequiredStorageKey();
$all_levels = $this->getLevels(); $all_levels = $this->getLevels();
$level = $request->getStr($control_name);
if (!$level) {
$level = $this->getValue(); $level = $this->getValue();
}
if (!$level) { if (!$level) {
$level = $this->getDefaultLevel(); $level = $this->getDefaultLevel();
} }