Introduce PhabricatorEmptyQueryException
Summary: It's dumb to execute a query which we know will return an empty result. Test Plan: Looked at comment preview with "11", didn't see "1 = 0" in DarkConsole. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D5177
This commit is contained in:
@@ -22,7 +22,7 @@ final class DiffusionCommitQuery
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function loadPage() {
|
||||
protected function loadPage() {
|
||||
$table = new PhabricatorRepositoryCommit();
|
||||
$conn_r = $table->establishConnection('r');
|
||||
|
||||
@@ -130,14 +130,14 @@ final class DiffusionCommitQuery
|
||||
}
|
||||
}
|
||||
|
||||
if ($sql) {
|
||||
$where[] = '('.implode(' OR ', $sql).')';
|
||||
} else {
|
||||
if (!$sql) {
|
||||
// If we discarded all possible identifiers (e.g., they all referenced
|
||||
// bogus repositories or were all too short), make sure the query finds
|
||||
// nothing.
|
||||
$where[] = qsprintf($conn_r, '1 = 0');
|
||||
throw new PhabricatorEmptyQueryException('No commit identifiers.');
|
||||
}
|
||||
|
||||
$where[] = '('.implode(' OR ', $sql).')';
|
||||
}
|
||||
|
||||
if ($this->phids) {
|
||||
|
||||
Reference in New Issue
Block a user