Page MenuHomePhabricator

D13327.diff
No OneTemporary

D13327.diff

diff --git a/src/aphront/AphrontController.php b/src/aphront/AphrontController.php
--- a/src/aphront/AphrontController.php
+++ b/src/aphront/AphrontController.php
@@ -35,8 +35,10 @@
throw new PhutilMethodNotImplementedException(
pht(
- 'Controllers must implement either handleRequest() (recommended) '.
- 'or processRequest() (deprecated).'));
+ 'Controllers must implement either %s (recommended) '.
+ 'or %s (deprecated).',
+ 'handleRequest()',
+ 'processRequest()'));
}
final public function setRequest(AphrontRequest $request) {
@@ -46,7 +48,7 @@
final public function getRequest() {
if (!$this->request) {
- throw new Exception(pht('Call setRequest() before getRequest()!'));
+ throw new PhutilInvalidStateException('setRequest');
}
return $this->request;
}
@@ -81,10 +83,12 @@
}
public function getDefaultResourceSource() {
- throw new Exception(
+ throw new MethodNotImplementedException(
pht(
- 'A Controller must implement getDefaultResourceSource() before you '.
- 'can invoke requireResource() or initBehavior().'));
+ 'A Controller must implement %s before you can invoke %s or %s.',
+ 'getDefaultResourceSource()',
+ 'requireResource()',
+ 'initBehavior()'));
}
public function requireResource($symbol) {
diff --git a/src/applications/auth/engine/PhabricatorAuthInviteEngine.php b/src/applications/auth/engine/PhabricatorAuthInviteEngine.php
--- a/src/applications/auth/engine/PhabricatorAuthInviteEngine.php
+++ b/src/applications/auth/engine/PhabricatorAuthInviteEngine.php
@@ -18,7 +18,7 @@
public function getViewer() {
if (!$this->viewer) {
- throw new Exception(pht('Call setViewer() before getViewer()!'));
+ throw new PhutilInvalidStateException('setViewer');
}
return $this->viewer;
}
diff --git a/src/applications/conpherence/view/ConpherenceTransactionView.php b/src/applications/conpherence/view/ConpherenceTransactionView.php
--- a/src/applications/conpherence/view/ConpherenceTransactionView.php
+++ b/src/applications/conpherence/view/ConpherenceTransactionView.php
@@ -64,7 +64,7 @@
public function render() {
$viewer = $this->getUser();
if (!$viewer) {
- throw new Exception(pht('Call setUser() before render()!'));
+ throw new PhutilInvalidStateException('setUser');
}
require_celerity_resource('conpherence-transaction-css');
diff --git a/src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php b/src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php
--- a/src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php
+++ b/src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php
@@ -277,9 +277,7 @@
*/
private function detectRenderingCycle(PhabricatorDashboardPanel $panel) {
if ($this->parentPanelPHIDs === null) {
- throw new Exception(
- pht(
- 'You must call setParentPanelPHIDs() before rendering panels.'));
+ throw new PhutilInvalidStateException('setParentPanelPHIDs');
}
$max_depth = 4;
diff --git a/src/infrastructure/markup/PhabricatorMarkupEngine.php b/src/infrastructure/markup/PhabricatorMarkupEngine.php
--- a/src/infrastructure/markup/PhabricatorMarkupEngine.php
+++ b/src/infrastructure/markup/PhabricatorMarkupEngine.php
@@ -198,10 +198,7 @@
}
if (!isset($this->objects[$key]['output'])) {
- throw new Exception(
- pht(
- 'Call %s before using results.',
- 'process()'));
+ throw new PhutilInvalidStateException('process');
}
}
diff --git a/src/view/form/control/AphrontFormPolicyControl.php b/src/view/form/control/AphrontFormPolicyControl.php
--- a/src/view/form/control/AphrontFormPolicyControl.php
+++ b/src/view/form/control/AphrontFormPolicyControl.php
@@ -162,10 +162,10 @@
protected function renderInput() {
if (!$this->object) {
- throw new Exception(pht('Call setPolicyObject() before rendering!'));
+ throw new PhutilInvalidStateException('setPolicyObject');
}
if (!$this->capability) {
- throw new Exception(pht('Call setCapability() before rendering!'));
+ throw new PhutilInvalidStateException('setCapability');
}
$policy = $this->object->getPolicy($this->capability);
diff --git a/src/view/form/control/AphrontFormTokenizerControl.php b/src/view/form/control/AphrontFormTokenizerControl.php
--- a/src/view/form/control/AphrontFormTokenizerControl.php
+++ b/src/view/form/control/AphrontFormTokenizerControl.php
@@ -109,8 +109,11 @@
if (!$viewer) {
throw new Exception(
pht(
- 'Call setUser() before rendering tokenizers. Use appendControl() '.
- 'on AphrontFormView to do this easily.'));
+ 'Call %s before rendering tokenizers. '.
+ 'Use %s on %s to do this easily.',
+ 'setUser()',
+ 'appendControl()',
+ 'AphrontFormView'));
}
$values = nonempty($this->getValue(), array());
diff --git a/src/view/layout/AphrontSideNavFilterView.php b/src/view/layout/AphrontSideNavFilterView.php
--- a/src/view/layout/AphrontSideNavFilterView.php
+++ b/src/view/layout/AphrontSideNavFilterView.php
@@ -187,10 +187,10 @@
public function render() {
if ($this->menu->getItems()) {
if (!$this->baseURI) {
- throw new Exception(pht('Call setBaseURI() before render()!'));
+ throw new PhutilInvalidStateException('setBaseURI');
}
if ($this->selectedFilter === false) {
- throw new Exception(pht('Call selectFilter() before render()!'));
+ throw new PhutilInvalidStateException('selectFilter');
}
}
diff --git a/src/view/layout/PhabricatorActionListView.php b/src/view/layout/PhabricatorActionListView.php
--- a/src/view/layout/PhabricatorActionListView.php
+++ b/src/view/layout/PhabricatorActionListView.php
@@ -29,7 +29,7 @@
public function render() {
if (!$this->user) {
- throw new Exception(pht('Call setUser() before render()!'));
+ throw new PhutilInvalidStateException('setUser');
}
$event = new PhabricatorEvent(
diff --git a/src/view/phui/PHUITagView.php b/src/view/phui/PHUITagView.php
--- a/src/view/phui/PHUITagView.php
+++ b/src/view/phui/PHUITagView.php
@@ -144,7 +144,7 @@
protected function getTagContent() {
if (!$this->type) {
- throw new Exception(pht('You must call setType() before render()!'));
+ throw new PhutilInvalidStateException('setType', 'render');
}
$color = null;

File Metadata

Mime Type
text/plain
Expires
Wed, May 22, 2:13 AM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6299951
Default Alt Text
D13327.diff (6 KB)

Event Timeline