diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index f0a27549ef7869cb591cb64b1e216fd993e0eb36..84de703301ff1be0100f32d81f75877d325003df 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -16,7 +16,6 @@ phutil_register_library_map(array( 'BurndownActionMenuEventListener' => 'events/BurndownActionMenuEventListener.php', 'BurndownChartView' => 'view/burndown/BurndownChartView.php', 'BurndownDataDate' => 'util/BurndownDataDate.php', - 'BurndownException' => 'exception/BurndownException.php', 'CeleritySprintResources' => 'celerity/CeleritySprintResources.php', 'DateIterator' => 'tests/DateIterator.php', 'EventTableView' => 'view/burndown/EventTableView.php', @@ -50,6 +49,7 @@ phutil_register_library_map(array( 'SprintDataViewController' => 'controller/SprintDataViewController.php', 'SprintDefaultViewCapability' => 'capability/SprintDefaultViewCapability.php', 'SprintEndDateField' => 'customfield/SprintEndDateField.php', + 'SprintException' => 'exception/SprintException.php', 'SprintGetIsSprintConduitAPIMethod' => 'conduit/SprintGetIsSprintConduitAPIMethod.php', 'SprintGetStartEndDatesConduitAPIMethod' => 'conduit/SprintGetStartEndDatesConduitAPIMethod.php', 'SprintGetTaskProjectHistoryConduitAPIMethod' => 'conduit/SprintGetTaskProjectHistoryConduitAPIMethod.php', @@ -91,7 +91,6 @@ phutil_register_library_map(array( 'BurndownActionMenuEventListener' => 'PhabricatorEventListener', 'BurndownChartView' => 'Phobject', 'BurndownDataDate' => 'Phobject', - 'BurndownException' => 'AphrontUsageException', 'CeleritySprintResources' => 'CelerityResourcesOnDisk', 'DateIterator' => 'Iterator', 'EventTableView' => 'Phobject', @@ -122,6 +121,7 @@ phutil_register_library_map(array( 'SprintDataViewController' => 'SprintController', 'SprintDefaultViewCapability' => 'PhabricatorPolicyCapability', 'SprintEndDateField' => 'SprintProjectCustomField', + 'SprintException' => 'AphrontException', 'SprintGetIsSprintConduitAPIMethod' => 'SprintConduitAPIMethod', 'SprintGetStartEndDatesConduitAPIMethod' => 'SprintConduitAPIMethod', 'SprintGetTaskProjectHistoryConduitAPIMethod' => 'SprintConduitAPIMethod', diff --git a/src/exception/BurndownException.php b/src/exception/BurndownException.php deleted file mode 100644 index 8ab10af5c3d8eab33bd495143a35114f2ca67d99..0000000000000000000000000000000000000000 --- a/src/exception/BurndownException.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -final class BurndownException extends AphrontUsageException {} diff --git a/src/exception/SprintException.php b/src/exception/SprintException.php new file mode 100644 index 0000000000000000000000000000000000000000..9ba5fd56f80610d2224138f3734c6c9116e63387 --- /dev/null +++ b/src/exception/SprintException.php @@ -0,0 +1,21 @@ +<?php + +final class SprintException extends AphrontException { + + private $title; + private $isUnlogged; + + public function __construct($title, $message, $unlogged = true) { + $this->title = $title; + $this->isUnlogged = $unlogged; + parent::__construct($message); + } + + public function getTitle() { + return $this->title; + } + + public function getIsUnlogged() { + return $this->isUnlogged; + } +} diff --git a/src/query/SprintQuery.php b/src/query/SprintQuery.php index 67d9e3c3f0d57fc045c5bb73ee131b553fdde211..05bb5b37979c41e26246a690da5bab6e173c4141 100644 --- a/src/query/SprintQuery.php +++ b/src/query/SprintQuery.php @@ -79,11 +79,13 @@ final class SprintQuery extends SprintDAO { ->needProjectPHIDs(true) ->execute(); if (empty($tasks)) { - $help = pht('To Create a Task, go to the Sprint Board and select the ' + $message = pht('The project "'.$this->project->getName().'"' + .' is not set up for Sprint because it has no tasks' + ."\n" + .'To Create a Task, go to the Sprint Board and select the ' .'column header menu'); - throw new BurndownException("The project \"".$this->project->getName() - ."\" is not set up for Sprint because " - ."it has no tasks\n", $help); + $ex = new SprintException('No Tasks in Project', $message, true); + throw $ex; } else { return $tasks; } @@ -147,9 +149,12 @@ final class SprintQuery extends SprintDAO { $sprint_phids[] = $value->getObjectPHID(); } if (empty($sprint_phids)) { - $help = pht('To Create a Sprint, go to /project/create/ and make sure that' + $message = pht('There are no Sprints to show yet' + ."\n" + .'To Create a Sprint, go to /project/create/ and make sure that' .' the "Is Sprint" box has been checked'); - throw new BurndownException("There are no Sprints to show yet\n", $help); + $ex = new SprintException('No Sprints', $message, true); + throw $ex; } else { return $sprint_phids; } @@ -284,9 +289,12 @@ final class SprintQuery extends SprintDAO { $columns = msort($columns, 'getSequence'); return $columns; } else { - $help = pht('To Create a Sprint Board, go to the Project profile page' + $message = pht('There is no Sprint Board yet' + ."\n" + .'To Create a Sprint Board, go to the Project profile page' .' and select the Sprint Board icon from the left side bar'); - throw new BurndownException("There is no Sprint Board yet\n", $help); + $ex = new SprintException('No Board', $message); + throw $ex; } }