@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`. Depends on D12803.

Test Plan: Unit tests pass.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

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

+47 -74
+1 -2
src/applications/auth/provider/PhabricatorAuthProvider.php
··· 15 15 16 16 public function getProviderConfig() { 17 17 if ($this->providerConfig === null) { 18 - throw new Exception( 19 - 'Call attachProviderConfig() before getProviderConfig()!'); 18 + throw new PhutilInvalidStateException('attachProviderConfig'); 20 19 } 21 20 return $this->providerConfig; 22 21 }
+1 -3
src/applications/celerity/CelerityResourceGraph.php
··· 7 7 8 8 protected function loadEdges(array $nodes) { 9 9 if (!$this->graphSet) { 10 - throw new Exception( 11 - 'Call setResourceGraph before loading the graph!' 12 - ); 10 + throw new PhutilInvalidStateException('setResourceGraph'); 13 11 } 14 12 15 13 $graph = $this->getResourceGraph();
+1 -2
src/applications/config/option/PhabricatorConfigOption.php
··· 122 122 return $this->enumOptions; 123 123 } 124 124 125 - throw new Exception( 126 - 'Call setEnumOptions() before trying to access them!'); 125 + throw new PhutilInvalidStateException('setEnumOptions'); 127 126 } 128 127 129 128 public function setKey($key) {
+1 -1
src/applications/config/schema/PhabricatorConfigSchemaQuery.php
··· 11 11 12 12 protected function getAPI() { 13 13 if (!$this->api) { 14 - throw new Exception(pht('Call setAPI() before issuing a query!')); 14 + throw new PhutilInvalidStateException('setAPI'); 15 15 } 16 16 return $this->api; 17 17 }
+1 -1
src/applications/daemon/view/PhabricatorDaemonLogEventsView.php
··· 27 27 $rows = array(); 28 28 29 29 if (!$this->user) { 30 - throw new Exception('Call setUser() before rendering!'); 30 + throw new PhutilInvalidStateException('setUser'); 31 31 } 32 32 33 33 foreach ($this->events as $event) {
+1 -1
src/applications/daemon/view/PhabricatorDaemonLogListView.php
··· 14 14 $rows = array(); 15 15 16 16 if (!$this->user) { 17 - throw new Exception('Call setUser() before rendering!'); 17 + throw new PhutilInvalidStateException('setUser'); 18 18 } 19 19 20 20 $env_hash = PhabricatorEnv::calculateEnvironmentHash();
+1 -1
src/applications/differential/view/DifferentialLocalCommitsView.php
··· 19 19 public function render() { 20 20 $user = $this->user; 21 21 if (!$user) { 22 - throw new Exception('Call setUser() before render()-ing this view.'); 22 + throw new PhutilInvalidStateException('setUser'); 23 23 } 24 24 25 25 $local = $this->localCommits;
+1 -2
src/applications/differential/view/DifferentialRevisionListView.php
··· 57 57 } 58 58 59 59 public function render() { 60 - 61 60 $user = $this->user; 62 61 if (!$user) { 63 - throw new Exception('Call setUser() before render()!'); 62 + throw new PhutilInvalidStateException('setUser'); 64 63 } 65 64 66 65 $fresh = PhabricatorEnv::getEnvConfig('differential.days-fresh');
+2 -2
src/applications/diffusion/query/DiffusionLintCountQuery.php
··· 23 23 24 24 public function execute() { 25 25 if (!$this->paths) { 26 - throw new Exception(pht('Call withPaths() before execute()!')); 26 + throw new PhutilInvalidStateException('withPaths'); 27 27 } 28 28 29 29 if (!$this->branchIDs) { 30 - throw new Exception(pht('Call withBranchIDs() before execute()!')); 30 + throw new PhutilInvalidStateException('withBranchIDs'); 31 31 } 32 32 33 33 $conn_r = id(new PhabricatorRepositoryCommit())->establishConnection('r');
+1 -1
src/applications/diffusion/query/lowlevel/DiffusionLowLevelQuery.php
··· 17 17 18 18 public function execute() { 19 19 if (!$this->getRepository()) { 20 - throw new Exception('Call setRepository() before execute()!'); 20 + throw new PhutilInvalidStateException('setRepository'); 21 21 } 22 22 23 23 return $this->executeQuery();
+2 -4
src/applications/diviner/atom/DivinerAtom.php
··· 95 95 96 96 public function getDocblockText() { 97 97 if ($this->docblockText === null) { 98 - throw new Exception( 99 - pht('Call %s before %s!', 'setDocblockRaw()', 'getDocblockText()')); 98 + throw new PhutilInvalidStateException('setDocblockRaw'); 100 99 } 101 100 return $this->docblockText; 102 101 } 103 102 104 103 public function getDocblockMeta() { 105 104 if ($this->docblockMeta === null) { 106 - throw new Exception( 107 - pht('Call %s before %s!', 'setDocblockRaw()', 'getDocblockMeta()')); 105 + throw new PhutilInvalidStateException('setDocblockRaw'); 108 106 } 109 107 return $this->docblockMeta; 110 108 }
+1 -1
src/applications/doorkeeper/view/DoorkeeperTagView.php
··· 12 12 public function render() { 13 13 $xobj = $this->xobj; 14 14 if (!$xobj) { 15 - throw new Exception('Call setExternalObject() before render()!'); 15 + throw new PhutilInvalidStateException('setExternalObject'); 16 16 } 17 17 18 18 $tag_id = celerity_generate_unique_node_id();
+1 -1
src/applications/files/controller/PhabricatorFileDataController.php
··· 227 227 228 228 private function getFile() { 229 229 if (!$this->file) { 230 - throw new Exception(pht('Call loadFile() before getFile()!')); 230 + throw new PhutilInvalidStateException('loadFile'); 231 231 } 232 232 return $this->file; 233 233 }
+1 -2
src/applications/fund/phortune/FundBackerCart.php
··· 33 33 34 34 $initiative = $this->getInitiative(); 35 35 if (!$initiative) { 36 - throw new Exception( 37 - pht('Call setInitiative() before building a cart!')); 36 + throw new PhutilInvalidStateException('setInitiative'); 38 37 } 39 38 40 39 $cart->setMetadataValue('initiativePHID', $initiative->getPHID());
+1 -1
src/applications/multimeter/data/MultimeterControl.php
··· 88 88 } 89 89 90 90 if ($this->sampleRate === null) { 91 - throw new Exception(pht('Call setSampleRate() before saving events!')); 91 + throw new PhutilInvalidStateException('setSampleRate'); 92 92 } 93 93 94 94 $this->addServiceEvents();
+1 -1
src/applications/paste/view/PasteEmbedView.php
··· 28 28 29 29 public function render() { 30 30 if (!$this->paste) { 31 - throw new Exception('Call setPaste() before render()!'); 31 + throw new PhutilInvalidStateException('setPaste'); 32 32 } 33 33 34 34 $lines = phutil_split_lines($this->paste->getContent());
+1 -1
src/applications/phid/query/PhabricatorObjectQuery.php
··· 78 78 79 79 public function getNamedResults() { 80 80 if ($this->namedResults === null) { 81 - throw new Exception('Call execute() before getNamedResults()!'); 81 + throw new PhutilInvalidStateException('execute'); 82 82 } 83 83 return $this->namedResults; 84 84 }
+1 -1
src/applications/pholio/view/PholioMockEmbedView.php
··· 17 17 18 18 public function render() { 19 19 if (!$this->mock) { 20 - throw new Exception('Call setMock() before render()!'); 20 + throw new PhutilInvalidStateException('setMock'); 21 21 } 22 22 $mock = $this->mock; 23 23
+1 -2
src/applications/phortune/cart/PhortuneSubscriptionCart.php
··· 34 34 35 35 $subscription = $this->getSubscription(); 36 36 if (!$subscription) { 37 - throw new Exception( 38 - pht('Call setSubscription() before building a cart!')); 37 + throw new PhutilInvalidStateException('setSubscription'); 39 38 } 40 39 41 40 $cart->setMetadataValue('subscriptionPHID', $subscription->getPHID());
+2 -8
src/applications/search/controller/PhabricatorApplicationSearchController.php
··· 55 55 56 56 $engine = $this->getSearchEngine(); 57 57 if (!$engine) { 58 - throw new Exception( 59 - pht( 60 - 'Call %s before delegating to this controller!', 61 - 'setEngine()')); 58 + throw new PhutilInvalidStateException('setEngine'); 62 59 } 63 60 64 61 $nav = $this->getNavigation(); 65 62 if (!$nav) { 66 - throw new Exception( 67 - pht( 68 - 'Call %s before delegating to this controller!', 69 - 'setNavigation()')); 63 + throw new PhutilInvalidStateException('setNavigation'); 70 64 } 71 65 72 66 $engine->setViewer($this->getRequest()->getUser());
+1 -1
src/applications/search/engine/PhabricatorApplicationSearchEngine.php
··· 33 33 34 34 protected function requireViewer() { 35 35 if (!$this->viewer) { 36 - throw new Exception('Call setViewer() before using an engine!'); 36 + throw new PhutilInvalidStateException('setViewer'); 37 37 } 38 38 return $this->viewer; 39 39 }
+1 -1
src/applications/slowvote/view/SlowvoteEmbedView.php
··· 22 22 23 23 public function render() { 24 24 if (!$this->poll) { 25 - throw new Exception('Call setPoll() before render()!'); 25 + throw new PhutilInvalidStateException('setPoll'); 26 26 } 27 27 28 28 $poll = $this->poll;
+1 -1
src/applications/subscriptions/editor/PhabricatorSubscriptionsEditor.php
··· 56 56 57 57 public function save() { 58 58 if (!$this->object) { 59 - throw new Exception('Call setObject() before save()!'); 59 + throw new PhutilInvalidStateException('setObject'); 60 60 } 61 61 $actor = $this->requireActor(); 62 62
+1 -2
src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php
··· 133 133 } 134 134 135 135 if (!$this->getContentSource()) { 136 - throw new Exception( 137 - 'Call setContentSource() before applyEdit()!'); 136 + throw new PhutilInvalidStateException('applyEdit'); 138 137 } 139 138 140 139 $actor = $this->requireActor();
+1 -2
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
··· 970 970 array $xactions) { 971 971 972 972 if (!$this->getContentSource()) { 973 - throw new Exception( 974 - 'Call setContentSource() before applyTransactions()!'); 973 + throw new PhutilInvalidStateException('setContentSource'); 975 974 } 976 975 977 976 // Do a bunch of sanity checks that the incoming transactions are fresh.
+1 -1
src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php
··· 149 149 } 150 150 151 151 if (!$this->getObjectPHID()) { 152 - throw new Exception('Call setObjectPHID() before render()!'); 152 + throw new PhutilInvalidStateException('setObjectPHID', 'render'); 153 153 } 154 154 155 155 return id(new AphrontFormView())
+2 -2
src/infrastructure/diff/view/PHUIDiffInlineCommentEditView.php
··· 76 76 77 77 public function render() { 78 78 if (!$this->uri) { 79 - throw new Exception('Call setSubmitURI() before render()!'); 79 + throw new PhutilInvalidStateException('setSubmitURI'); 80 80 } 81 81 if (!$this->user) { 82 - throw new Exception('Call setUser() before render()!'); 82 + throw new PhutilInvalidStateException('setUser'); 83 83 } 84 84 85 85 $content = phabricator_form(
+4 -8
src/view/control/AphrontCursorPagerView.php
··· 92 92 93 93 public function getFirstPageURI() { 94 94 if (!$this->uri) { 95 - throw new Exception( 96 - pht('You must call setURI() before you can call getFirstPageURI().')); 95 + throw new PhutilInvalidStateException('setURI'); 97 96 } 98 97 99 98 if (!$this->afterID && !($this->beforeID && $this->moreResults)) { ··· 107 106 108 107 public function getPrevPageURI() { 109 108 if (!$this->uri) { 110 - throw new Exception( 111 - pht('You must call setURI() before you can call getPrevPageURI().')); 109 + throw new PhutilInvalidStateException('getPrevPageURI'); 112 110 } 113 111 114 112 if (!$this->prevPageID) { ··· 122 120 123 121 public function getNextPageURI() { 124 122 if (!$this->uri) { 125 - throw new Exception( 126 - pht('You must call setURI() before you can call getNextPageURI().')); 123 + throw new PhutilInvalidStateException('setURI'); 127 124 } 128 125 129 126 if (!$this->nextPageID) { ··· 137 134 138 135 public function render() { 139 136 if (!$this->uri) { 140 - throw new Exception( 141 - pht('You must call setURI() before you can call render().')); 137 + throw new PhutilInvalidStateException('setURI'); 142 138 } 143 139 144 140 $links = array();
+1 -2
src/view/control/AphrontPagerView.php
··· 109 109 110 110 public function render() { 111 111 if (!$this->uri) { 112 - throw new Exception( 113 - pht('You must call setURI() before you can call render().')); 112 + throw new PhutilInvalidStateException('setURI'); 114 113 } 115 114 116 115 require_celerity_resource('aphront-pager-view-css');
+1 -5
src/view/form/PHUIFormLayoutView.php
··· 32 32 33 33 public function appendRemarkupInstructions($remarkup) { 34 34 if ($this->getUser() === null) { 35 - throw new Exception( 36 - pht( 37 - 'Call %s before appending Remarkup to %s.', 38 - 'setUser()', 39 - __CLASS__)); 35 + throw new PhutilInvalidStateException('setUser'); 40 36 } 41 37 42 38 return $this->appendInstructions(
+1 -5
src/view/form/control/PhabricatorRemarkupControl.php
··· 24 24 25 25 $viewer = $this->getUser(); 26 26 if (!$viewer) { 27 - throw new Exception( 28 - pht( 29 - 'Call %s before rendering a %s!', 30 - 'setUser()', 31 - __CLASS__)); 27 + throw new PhutilInvalidStateException('setUser'); 32 28 } 33 29 34 30 // We need to have this if previews render images, since Ajax can not
+7 -4
src/view/phui/PHUIRemarkupPreviewPanel.php
··· 42 42 ); 43 43 44 44 if (empty($skins[$skin])) { 45 - $valid = implode(', ', array_keys($skins)); 46 - throw new Exception("Invalid skin '{$skin}'. Valid skins are: {$valid}."); 45 + throw new Exception( 46 + pht( 47 + "Invalid skin '%s'. Valid skins are: %s.", 48 + $skin, 49 + implode(', ', array_keys($skins)))); 47 50 } 48 51 49 52 $this->skin = $skin; ··· 69 72 70 73 protected function getTagContent() { 71 74 if ($this->previewURI === null) { 72 - throw new Exception('Call setPreviewURI() before rendering!'); 75 + throw new PhutilInvalidStateException('setPreviewURI'); 73 76 } 74 77 if ($this->controlID === null) { 75 - throw new Exception('Call setControlID() before rendering!'); 78 + throw new PhutilInvalidStateException('setControlID'); 76 79 } 77 80 78 81 $preview_id = celerity_generate_unique_node_id();
+1 -1
src/view/phui/calendar/PHUICalendarMonthView.php
··· 59 59 60 60 public function render() { 61 61 if (empty($this->user)) { 62 - throw new Exception('Call setUser() before render()!'); 62 + throw new PhutilInvalidStateException('setUser'); 63 63 } 64 64 65 65 $events = msort($this->events, 'getEpochStart');
+1 -1
src/view/widget/hovercard/PhabricatorHovercardView.php
··· 62 62 63 63 public function render() { 64 64 if (!$this->handle) { 65 - throw new Exception('Call setObjectHandle() before calling render()!'); 65 + throw new PhutilInvalidStateException('setObjectHandle'); 66 66 } 67 67 68 68 $handle = $this->handle;