Page MenuHomePhabricator

D12829.diff
No OneTemporary

D12829.diff

diff --git a/src/applications/auth/provider/PhabricatorAuthProvider.php b/src/applications/auth/provider/PhabricatorAuthProvider.php
--- a/src/applications/auth/provider/PhabricatorAuthProvider.php
+++ b/src/applications/auth/provider/PhabricatorAuthProvider.php
@@ -15,8 +15,7 @@
public function getProviderConfig() {
if ($this->providerConfig === null) {
- throw new Exception(
- 'Call attachProviderConfig() before getProviderConfig()!');
+ throw new PhutilInvalidStateException('attachProviderConfig');
}
return $this->providerConfig;
}
diff --git a/src/applications/celerity/CelerityResourceGraph.php b/src/applications/celerity/CelerityResourceGraph.php
--- a/src/applications/celerity/CelerityResourceGraph.php
+++ b/src/applications/celerity/CelerityResourceGraph.php
@@ -7,9 +7,7 @@
protected function loadEdges(array $nodes) {
if (!$this->graphSet) {
- throw new Exception(
- 'Call setResourceGraph before loading the graph!'
- );
+ throw new PhutilInvalidStateException('setResourceGraph');
}
$graph = $this->getResourceGraph();
diff --git a/src/applications/config/option/PhabricatorConfigOption.php b/src/applications/config/option/PhabricatorConfigOption.php
--- a/src/applications/config/option/PhabricatorConfigOption.php
+++ b/src/applications/config/option/PhabricatorConfigOption.php
@@ -122,8 +122,7 @@
return $this->enumOptions;
}
- throw new Exception(
- 'Call setEnumOptions() before trying to access them!');
+ throw new PhutilInvalidStateException('setEnumOptions');
}
public function setKey($key) {
diff --git a/src/applications/config/schema/PhabricatorConfigSchemaQuery.php b/src/applications/config/schema/PhabricatorConfigSchemaQuery.php
--- a/src/applications/config/schema/PhabricatorConfigSchemaQuery.php
+++ b/src/applications/config/schema/PhabricatorConfigSchemaQuery.php
@@ -11,7 +11,7 @@
protected function getAPI() {
if (!$this->api) {
- throw new Exception(pht('Call setAPI() before issuing a query!'));
+ throw new PhutilInvalidStateException('setAPI');
}
return $this->api;
}
diff --git a/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php b/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php
--- a/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php
+++ b/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php
@@ -27,7 +27,7 @@
$rows = array();
if (!$this->user) {
- throw new Exception('Call setUser() before rendering!');
+ throw new PhutilInvalidStateException('setUser');
}
foreach ($this->events as $event) {
diff --git a/src/applications/daemon/view/PhabricatorDaemonLogListView.php b/src/applications/daemon/view/PhabricatorDaemonLogListView.php
--- a/src/applications/daemon/view/PhabricatorDaemonLogListView.php
+++ b/src/applications/daemon/view/PhabricatorDaemonLogListView.php
@@ -14,7 +14,7 @@
$rows = array();
if (!$this->user) {
- throw new Exception('Call setUser() before rendering!');
+ throw new PhutilInvalidStateException('setUser');
}
$env_hash = PhabricatorEnv::calculateEnvironmentHash();
diff --git a/src/applications/differential/view/DifferentialLocalCommitsView.php b/src/applications/differential/view/DifferentialLocalCommitsView.php
--- a/src/applications/differential/view/DifferentialLocalCommitsView.php
+++ b/src/applications/differential/view/DifferentialLocalCommitsView.php
@@ -19,7 +19,7 @@
public function render() {
$user = $this->user;
if (!$user) {
- throw new Exception('Call setUser() before render()-ing this view.');
+ throw new PhutilInvalidStateException('setUser');
}
$local = $this->localCommits;
diff --git a/src/applications/differential/view/DifferentialRevisionListView.php b/src/applications/differential/view/DifferentialRevisionListView.php
--- a/src/applications/differential/view/DifferentialRevisionListView.php
+++ b/src/applications/differential/view/DifferentialRevisionListView.php
@@ -57,10 +57,9 @@
}
public function render() {
-
$user = $this->user;
if (!$user) {
- throw new Exception('Call setUser() before render()!');
+ throw new PhutilInvalidStateException('setUser');
}
$fresh = PhabricatorEnv::getEnvConfig('differential.days-fresh');
diff --git a/src/applications/diffusion/query/DiffusionLintCountQuery.php b/src/applications/diffusion/query/DiffusionLintCountQuery.php
--- a/src/applications/diffusion/query/DiffusionLintCountQuery.php
+++ b/src/applications/diffusion/query/DiffusionLintCountQuery.php
@@ -23,11 +23,11 @@
public function execute() {
if (!$this->paths) {
- throw new Exception(pht('Call withPaths() before execute()!'));
+ throw new PhutilInvalidStateException('withPaths');
}
if (!$this->branchIDs) {
- throw new Exception(pht('Call withBranchIDs() before execute()!'));
+ throw new PhutilInvalidStateException('withBranchIDs');
}
$conn_r = id(new PhabricatorRepositoryCommit())->establishConnection('r');
diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelQuery.php
--- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelQuery.php
+++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelQuery.php
@@ -17,7 +17,7 @@
public function execute() {
if (!$this->getRepository()) {
- throw new Exception('Call setRepository() before execute()!');
+ throw new PhutilInvalidStateException('setRepository');
}
return $this->executeQuery();
diff --git a/src/applications/diviner/atom/DivinerAtom.php b/src/applications/diviner/atom/DivinerAtom.php
--- a/src/applications/diviner/atom/DivinerAtom.php
+++ b/src/applications/diviner/atom/DivinerAtom.php
@@ -95,16 +95,14 @@
public function getDocblockText() {
if ($this->docblockText === null) {
- throw new Exception(
- pht('Call %s before %s!', 'setDocblockRaw()', 'getDocblockText()'));
+ throw new PhutilInvalidStateException('setDocblockRaw');
}
return $this->docblockText;
}
public function getDocblockMeta() {
if ($this->docblockMeta === null) {
- throw new Exception(
- pht('Call %s before %s!', 'setDocblockRaw()', 'getDocblockMeta()'));
+ throw new PhutilInvalidStateException('setDocblockRaw');
}
return $this->docblockMeta;
}
diff --git a/src/applications/doorkeeper/view/DoorkeeperTagView.php b/src/applications/doorkeeper/view/DoorkeeperTagView.php
--- a/src/applications/doorkeeper/view/DoorkeeperTagView.php
+++ b/src/applications/doorkeeper/view/DoorkeeperTagView.php
@@ -12,7 +12,7 @@
public function render() {
$xobj = $this->xobj;
if (!$xobj) {
- throw new Exception('Call setExternalObject() before render()!');
+ throw new PhutilInvalidStateException('setExternalObject');
}
$tag_id = celerity_generate_unique_node_id();
diff --git a/src/applications/files/controller/PhabricatorFileDataController.php b/src/applications/files/controller/PhabricatorFileDataController.php
--- a/src/applications/files/controller/PhabricatorFileDataController.php
+++ b/src/applications/files/controller/PhabricatorFileDataController.php
@@ -227,7 +227,7 @@
private function getFile() {
if (!$this->file) {
- throw new Exception(pht('Call loadFile() before getFile()!'));
+ throw new PhutilInvalidStateException('loadFile');
}
return $this->file;
}
diff --git a/src/applications/fund/phortune/FundBackerCart.php b/src/applications/fund/phortune/FundBackerCart.php
--- a/src/applications/fund/phortune/FundBackerCart.php
+++ b/src/applications/fund/phortune/FundBackerCart.php
@@ -33,8 +33,7 @@
$initiative = $this->getInitiative();
if (!$initiative) {
- throw new Exception(
- pht('Call setInitiative() before building a cart!'));
+ throw new PhutilInvalidStateException('setInitiative');
}
$cart->setMetadataValue('initiativePHID', $initiative->getPHID());
diff --git a/src/applications/multimeter/data/MultimeterControl.php b/src/applications/multimeter/data/MultimeterControl.php
--- a/src/applications/multimeter/data/MultimeterControl.php
+++ b/src/applications/multimeter/data/MultimeterControl.php
@@ -88,7 +88,7 @@
}
if ($this->sampleRate === null) {
- throw new Exception(pht('Call setSampleRate() before saving events!'));
+ throw new PhutilInvalidStateException('setSampleRate');
}
$this->addServiceEvents();
diff --git a/src/applications/paste/view/PasteEmbedView.php b/src/applications/paste/view/PasteEmbedView.php
--- a/src/applications/paste/view/PasteEmbedView.php
+++ b/src/applications/paste/view/PasteEmbedView.php
@@ -28,7 +28,7 @@
public function render() {
if (!$this->paste) {
- throw new Exception('Call setPaste() before render()!');
+ throw new PhutilInvalidStateException('setPaste');
}
$lines = phutil_split_lines($this->paste->getContent());
diff --git a/src/applications/phid/query/PhabricatorObjectQuery.php b/src/applications/phid/query/PhabricatorObjectQuery.php
--- a/src/applications/phid/query/PhabricatorObjectQuery.php
+++ b/src/applications/phid/query/PhabricatorObjectQuery.php
@@ -78,7 +78,7 @@
public function getNamedResults() {
if ($this->namedResults === null) {
- throw new Exception('Call execute() before getNamedResults()!');
+ throw new PhutilInvalidStateException('execute');
}
return $this->namedResults;
}
diff --git a/src/applications/pholio/view/PholioMockEmbedView.php b/src/applications/pholio/view/PholioMockEmbedView.php
--- a/src/applications/pholio/view/PholioMockEmbedView.php
+++ b/src/applications/pholio/view/PholioMockEmbedView.php
@@ -17,7 +17,7 @@
public function render() {
if (!$this->mock) {
- throw new Exception('Call setMock() before render()!');
+ throw new PhutilInvalidStateException('setMock');
}
$mock = $this->mock;
diff --git a/src/applications/phortune/cart/PhortuneSubscriptionCart.php b/src/applications/phortune/cart/PhortuneSubscriptionCart.php
--- a/src/applications/phortune/cart/PhortuneSubscriptionCart.php
+++ b/src/applications/phortune/cart/PhortuneSubscriptionCart.php
@@ -34,8 +34,7 @@
$subscription = $this->getSubscription();
if (!$subscription) {
- throw new Exception(
- pht('Call setSubscription() before building a cart!'));
+ throw new PhutilInvalidStateException('setSubscription');
}
$cart->setMetadataValue('subscriptionPHID', $subscription->getPHID());
diff --git a/src/applications/search/controller/PhabricatorApplicationSearchController.php b/src/applications/search/controller/PhabricatorApplicationSearchController.php
--- a/src/applications/search/controller/PhabricatorApplicationSearchController.php
+++ b/src/applications/search/controller/PhabricatorApplicationSearchController.php
@@ -55,18 +55,12 @@
$engine = $this->getSearchEngine();
if (!$engine) {
- throw new Exception(
- pht(
- 'Call %s before delegating to this controller!',
- 'setEngine()'));
+ throw new PhutilInvalidStateException('setEngine');
}
$nav = $this->getNavigation();
if (!$nav) {
- throw new Exception(
- pht(
- 'Call %s before delegating to this controller!',
- 'setNavigation()'));
+ throw new PhutilInvalidStateException('setNavigation');
}
$engine->setViewer($this->getRequest()->getUser());
diff --git a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
--- a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
+++ b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
@@ -33,7 +33,7 @@
protected function requireViewer() {
if (!$this->viewer) {
- throw new Exception('Call setViewer() before using an engine!');
+ throw new PhutilInvalidStateException('setViewer');
}
return $this->viewer;
}
diff --git a/src/applications/slowvote/view/SlowvoteEmbedView.php b/src/applications/slowvote/view/SlowvoteEmbedView.php
--- a/src/applications/slowvote/view/SlowvoteEmbedView.php
+++ b/src/applications/slowvote/view/SlowvoteEmbedView.php
@@ -22,7 +22,7 @@
public function render() {
if (!$this->poll) {
- throw new Exception('Call setPoll() before render()!');
+ throw new PhutilInvalidStateException('setPoll');
}
$poll = $this->poll;
diff --git a/src/applications/subscriptions/editor/PhabricatorSubscriptionsEditor.php b/src/applications/subscriptions/editor/PhabricatorSubscriptionsEditor.php
--- a/src/applications/subscriptions/editor/PhabricatorSubscriptionsEditor.php
+++ b/src/applications/subscriptions/editor/PhabricatorSubscriptionsEditor.php
@@ -56,7 +56,7 @@
public function save() {
if (!$this->object) {
- throw new Exception('Call setObject() before save()!');
+ throw new PhutilInvalidStateException('setObject');
}
$actor = $this->requireActor();
diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php
--- a/src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php
+++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php
@@ -133,8 +133,7 @@
}
if (!$this->getContentSource()) {
- throw new Exception(
- 'Call setContentSource() before applyEdit()!');
+ throw new PhutilInvalidStateException('applyEdit');
}
$actor = $this->requireActor();
diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
--- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
+++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
@@ -970,8 +970,7 @@
array $xactions) {
if (!$this->getContentSource()) {
- throw new Exception(
- 'Call setContentSource() before applyTransactions()!');
+ throw new PhutilInvalidStateException('setContentSource');
}
// Do a bunch of sanity checks that the incoming transactions are fresh.
diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php
--- a/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php
+++ b/src/applications/transactions/view/PhabricatorApplicationTransactionCommentView.php
@@ -149,7 +149,7 @@
}
if (!$this->getObjectPHID()) {
- throw new Exception('Call setObjectPHID() before render()!');
+ throw new PhutilInvalidStateException('setObjectPHID', 'render');
}
return id(new AphrontFormView())
diff --git a/src/infrastructure/diff/view/PHUIDiffInlineCommentEditView.php b/src/infrastructure/diff/view/PHUIDiffInlineCommentEditView.php
--- a/src/infrastructure/diff/view/PHUIDiffInlineCommentEditView.php
+++ b/src/infrastructure/diff/view/PHUIDiffInlineCommentEditView.php
@@ -76,10 +76,10 @@
public function render() {
if (!$this->uri) {
- throw new Exception('Call setSubmitURI() before render()!');
+ throw new PhutilInvalidStateException('setSubmitURI');
}
if (!$this->user) {
- throw new Exception('Call setUser() before render()!');
+ throw new PhutilInvalidStateException('setUser');
}
$content = phabricator_form(
diff --git a/src/view/control/AphrontCursorPagerView.php b/src/view/control/AphrontCursorPagerView.php
--- a/src/view/control/AphrontCursorPagerView.php
+++ b/src/view/control/AphrontCursorPagerView.php
@@ -92,8 +92,7 @@
public function getFirstPageURI() {
if (!$this->uri) {
- throw new Exception(
- pht('You must call setURI() before you can call getFirstPageURI().'));
+ throw new PhutilInvalidStateException('setURI');
}
if (!$this->afterID && !($this->beforeID && $this->moreResults)) {
@@ -107,8 +106,7 @@
public function getPrevPageURI() {
if (!$this->uri) {
- throw new Exception(
- pht('You must call setURI() before you can call getPrevPageURI().'));
+ throw new PhutilInvalidStateException('getPrevPageURI');
}
if (!$this->prevPageID) {
@@ -122,8 +120,7 @@
public function getNextPageURI() {
if (!$this->uri) {
- throw new Exception(
- pht('You must call setURI() before you can call getNextPageURI().'));
+ throw new PhutilInvalidStateException('setURI');
}
if (!$this->nextPageID) {
@@ -137,8 +134,7 @@
public function render() {
if (!$this->uri) {
- throw new Exception(
- pht('You must call setURI() before you can call render().'));
+ throw new PhutilInvalidStateException('setURI');
}
$links = array();
diff --git a/src/view/control/AphrontPagerView.php b/src/view/control/AphrontPagerView.php
--- a/src/view/control/AphrontPagerView.php
+++ b/src/view/control/AphrontPagerView.php
@@ -109,8 +109,7 @@
public function render() {
if (!$this->uri) {
- throw new Exception(
- pht('You must call setURI() before you can call render().'));
+ throw new PhutilInvalidStateException('setURI');
}
require_celerity_resource('aphront-pager-view-css');
diff --git a/src/view/form/PHUIFormLayoutView.php b/src/view/form/PHUIFormLayoutView.php
--- a/src/view/form/PHUIFormLayoutView.php
+++ b/src/view/form/PHUIFormLayoutView.php
@@ -32,11 +32,7 @@
public function appendRemarkupInstructions($remarkup) {
if ($this->getUser() === null) {
- throw new Exception(
- pht(
- 'Call %s before appending Remarkup to %s.',
- 'setUser()',
- __CLASS__));
+ throw new PhutilInvalidStateException('setUser');
}
return $this->appendInstructions(
diff --git a/src/view/form/control/PhabricatorRemarkupControl.php b/src/view/form/control/PhabricatorRemarkupControl.php
--- a/src/view/form/control/PhabricatorRemarkupControl.php
+++ b/src/view/form/control/PhabricatorRemarkupControl.php
@@ -24,11 +24,7 @@
$viewer = $this->getUser();
if (!$viewer) {
- throw new Exception(
- pht(
- 'Call %s before rendering a %s!',
- 'setUser()',
- __CLASS__));
+ throw new PhutilInvalidStateException('setUser');
}
// We need to have this if previews render images, since Ajax can not
diff --git a/src/view/phui/PHUIRemarkupPreviewPanel.php b/src/view/phui/PHUIRemarkupPreviewPanel.php
--- a/src/view/phui/PHUIRemarkupPreviewPanel.php
+++ b/src/view/phui/PHUIRemarkupPreviewPanel.php
@@ -42,8 +42,11 @@
);
if (empty($skins[$skin])) {
- $valid = implode(', ', array_keys($skins));
- throw new Exception("Invalid skin '{$skin}'. Valid skins are: {$valid}.");
+ throw new Exception(
+ pht(
+ "Invalid skin '%s'. Valid skins are: %s.",
+ $skin,
+ implode(', ', array_keys($skins))));
}
$this->skin = $skin;
@@ -69,10 +72,10 @@
protected function getTagContent() {
if ($this->previewURI === null) {
- throw new Exception('Call setPreviewURI() before rendering!');
+ throw new PhutilInvalidStateException('setPreviewURI');
}
if ($this->controlID === null) {
- throw new Exception('Call setControlID() before rendering!');
+ throw new PhutilInvalidStateException('setControlID');
}
$preview_id = celerity_generate_unique_node_id();
diff --git a/src/view/phui/calendar/PHUICalendarMonthView.php b/src/view/phui/calendar/PHUICalendarMonthView.php
--- a/src/view/phui/calendar/PHUICalendarMonthView.php
+++ b/src/view/phui/calendar/PHUICalendarMonthView.php
@@ -59,7 +59,7 @@
public function render() {
if (empty($this->user)) {
- throw new Exception('Call setUser() before render()!');
+ throw new PhutilInvalidStateException('setUser');
}
$events = msort($this->events, 'getEpochStart');
diff --git a/src/view/widget/hovercard/PhabricatorHovercardView.php b/src/view/widget/hovercard/PhabricatorHovercardView.php
--- a/src/view/widget/hovercard/PhabricatorHovercardView.php
+++ b/src/view/widget/hovercard/PhabricatorHovercardView.php
@@ -62,7 +62,7 @@
public function render() {
if (!$this->handle) {
- throw new Exception('Call setObjectHandle() before calling render()!');
+ throw new PhutilInvalidStateException('setObjectHandle');
}
$handle = $this->handle;

File Metadata

Mime Type
text/plain
Expires
Sun, May 12, 5:22 AM (3 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6289844
Default Alt Text
D12829.diff (20 KB)

Event Timeline