@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use PhutilInvalidStateException

Summary: Use `PhutilInvalidStateException` where appropriate.

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13327

+25 -23
+10 -6
src/aphront/AphrontController.php
··· 35 35 36 36 throw new PhutilMethodNotImplementedException( 37 37 pht( 38 - 'Controllers must implement either handleRequest() (recommended) '. 39 - 'or processRequest() (deprecated).')); 38 + 'Controllers must implement either %s (recommended) '. 39 + 'or %s (deprecated).', 40 + 'handleRequest()', 41 + 'processRequest()')); 40 42 } 41 43 42 44 final public function setRequest(AphrontRequest $request) { ··· 46 48 47 49 final public function getRequest() { 48 50 if (!$this->request) { 49 - throw new Exception(pht('Call setRequest() before getRequest()!')); 51 + throw new PhutilInvalidStateException('setRequest'); 50 52 } 51 53 return $this->request; 52 54 } ··· 81 83 } 82 84 83 85 public function getDefaultResourceSource() { 84 - throw new Exception( 86 + throw new MethodNotImplementedException( 85 87 pht( 86 - 'A Controller must implement getDefaultResourceSource() before you '. 87 - 'can invoke requireResource() or initBehavior().')); 88 + 'A Controller must implement %s before you can invoke %s or %s.', 89 + 'getDefaultResourceSource()', 90 + 'requireResource()', 91 + 'initBehavior()')); 88 92 } 89 93 90 94 public function requireResource($symbol) {
+1 -1
src/applications/auth/engine/PhabricatorAuthInviteEngine.php
··· 18 18 19 19 public function getViewer() { 20 20 if (!$this->viewer) { 21 - throw new Exception(pht('Call setViewer() before getViewer()!')); 21 + throw new PhutilInvalidStateException('setViewer'); 22 22 } 23 23 return $this->viewer; 24 24 }
+1 -1
src/applications/conpherence/view/ConpherenceTransactionView.php
··· 64 64 public function render() { 65 65 $viewer = $this->getUser(); 66 66 if (!$viewer) { 67 - throw new Exception(pht('Call setUser() before render()!')); 67 + throw new PhutilInvalidStateException('setUser'); 68 68 } 69 69 70 70 require_celerity_resource('conpherence-transaction-css');
+1 -3
src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php
··· 277 277 */ 278 278 private function detectRenderingCycle(PhabricatorDashboardPanel $panel) { 279 279 if ($this->parentPanelPHIDs === null) { 280 - throw new Exception( 281 - pht( 282 - 'You must call setParentPanelPHIDs() before rendering panels.')); 280 + throw new PhutilInvalidStateException('setParentPanelPHIDs'); 283 281 } 284 282 285 283 $max_depth = 4;
+1 -4
src/infrastructure/markup/PhabricatorMarkupEngine.php
··· 198 198 } 199 199 200 200 if (!isset($this->objects[$key]['output'])) { 201 - throw new Exception( 202 - pht( 203 - 'Call %s before using results.', 204 - 'process()')); 201 + throw new PhutilInvalidStateException('process'); 205 202 } 206 203 } 207 204
+2 -2
src/view/form/control/AphrontFormPolicyControl.php
··· 162 162 163 163 protected function renderInput() { 164 164 if (!$this->object) { 165 - throw new Exception(pht('Call setPolicyObject() before rendering!')); 165 + throw new PhutilInvalidStateException('setPolicyObject'); 166 166 } 167 167 if (!$this->capability) { 168 - throw new Exception(pht('Call setCapability() before rendering!')); 168 + throw new PhutilInvalidStateException('setCapability'); 169 169 } 170 170 171 171 $policy = $this->object->getPolicy($this->capability);
+5 -2
src/view/form/control/AphrontFormTokenizerControl.php
··· 109 109 if (!$viewer) { 110 110 throw new Exception( 111 111 pht( 112 - 'Call setUser() before rendering tokenizers. Use appendControl() '. 113 - 'on AphrontFormView to do this easily.')); 112 + 'Call %s before rendering tokenizers. '. 113 + 'Use %s on %s to do this easily.', 114 + 'setUser()', 115 + 'appendControl()', 116 + 'AphrontFormView')); 114 117 } 115 118 116 119 $values = nonempty($this->getValue(), array());
+2 -2
src/view/layout/AphrontSideNavFilterView.php
··· 187 187 public function render() { 188 188 if ($this->menu->getItems()) { 189 189 if (!$this->baseURI) { 190 - throw new Exception(pht('Call setBaseURI() before render()!')); 190 + throw new PhutilInvalidStateException('setBaseURI'); 191 191 } 192 192 if ($this->selectedFilter === false) { 193 - throw new Exception(pht('Call selectFilter() before render()!')); 193 + throw new PhutilInvalidStateException('selectFilter'); 194 194 } 195 195 } 196 196
+1 -1
src/view/layout/PhabricatorActionListView.php
··· 29 29 30 30 public function render() { 31 31 if (!$this->user) { 32 - throw new Exception(pht('Call setUser() before render()!')); 32 + throw new PhutilInvalidStateException('setUser'); 33 33 } 34 34 35 35 $event = new PhabricatorEvent(
+1 -1
src/view/phui/PHUITagView.php
··· 144 144 145 145 protected function getTagContent() { 146 146 if (!$this->type) { 147 - throw new Exception(pht('You must call setType() before render()!')); 147 + throw new PhutilInvalidStateException('setType', 'render'); 148 148 } 149 149 150 150 $color = null;