Rename AphrontQueryException subclasses
				
					
				
			Summary: Ref T5655. Depends on D10149. Test Plan: Ran `arc unit` Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin, hach-que Maniphest Tasks: T5655 Differential Revision: https://secure.phabricator.com/D10150
This commit is contained in:
		| @@ -58,7 +58,7 @@ while ($update) { | |||||||
|         $project->getID()); |         $project->getID()); | ||||||
|       unset($update[$key]); |       unset($update[$key]); | ||||||
|       echo "okay.\n"; |       echo "okay.\n"; | ||||||
|     } catch (AphrontQueryDuplicateKeyException $ex) { |     } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|       echo "failed, will retry.\n"; |       echo "failed, will retry.\n"; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -187,7 +187,7 @@ foreach ($rows as $row) { | |||||||
|  |  | ||||||
|   try { |   try { | ||||||
|     $saved->save(); |     $saved->save(); | ||||||
|   } catch (AphrontQueryDuplicateKeyException $ex) { |   } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|     // Ignore this, we just have duplicate saved queries. |     // Ignore this, we just have duplicate saved queries. | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -113,11 +113,11 @@ final class PhabricatorInfrastructureTestCase extends PhabricatorTestCase { | |||||||
|     $caught = null; |     $caught = null; | ||||||
|     try { |     try { | ||||||
|       qsprintf($conn_r, 'SELECT %s', $gclef); |       qsprintf($conn_r, 'SELECT %s', $gclef); | ||||||
|     } catch (AphrontQueryCharacterSetException $ex) { |     } catch (AphrontCharacterSetQueryException $ex) { | ||||||
|       $caught = $ex; |       $caught = $ex; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     $this->assertTrue($caught instanceof AphrontQueryCharacterSetException); |     $this->assertTrue($caught instanceof AphrontCharacterSetQueryException); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -250,7 +250,7 @@ class AphrontDefaultApplicationConfiguration | |||||||
|     $class    = get_class($ex); |     $class    = get_class($ex); | ||||||
|     $message  = $ex->getMessage(); |     $message  = $ex->getMessage(); | ||||||
|  |  | ||||||
|     if ($ex instanceof AphrontQuerySchemaException) { |     if ($ex instanceof AphrontSchemaQueryException) { | ||||||
|       $message .= |       $message .= | ||||||
|         "\n\n". |         "\n\n". | ||||||
|         "NOTE: This usually indicates that the MySQL schema has not been ". |         "NOTE: This usually indicates that the MySQL schema has not been ". | ||||||
|   | |||||||
| @@ -304,7 +304,7 @@ final class PhabricatorAuthRegisterController | |||||||
|           } |           } | ||||||
|  |  | ||||||
|           return $this->loginUser($user); |           return $this->loginUser($user); | ||||||
|         } catch (AphrontQueryDuplicateKeyException $exception) { |         } catch (AphrontDuplicateKeyQueryException $exception) { | ||||||
|           $same_username = id(new PhabricatorUser())->loadOneWhere( |           $same_username = id(new PhabricatorUser())->loadOneWhere( | ||||||
|             'userName = %s', |             'userName = %s', | ||||||
|             $user->getUserName()); |             $user->getUserName()); | ||||||
|   | |||||||
| @@ -30,7 +30,7 @@ final class PhabricatorSetupCheckDatabase extends PhabricatorSetupCheck { | |||||||
|  |  | ||||||
|     try { |     try { | ||||||
|       queryfx($conn_raw, 'SELECT 1'); |       queryfx($conn_raw, 'SELECT 1'); | ||||||
|     } catch (AphrontQueryConnectionException $ex) { |     } catch (AphrontConnectionQueryException $ex) { | ||||||
|       $message = pht( |       $message = pht( | ||||||
|         "Unable to connect to MySQL!\n\n". |         "Unable to connect to MySQL!\n\n". | ||||||
|         "%s\n\n". |         "%s\n\n". | ||||||
|   | |||||||
| @@ -16,7 +16,7 @@ final class DifferentialDraft extends DifferentialDAO { | |||||||
|         ->setAuthorPHID($author_phid) |         ->setAuthorPHID($author_phid) | ||||||
|         ->setDraftKey($draft_key) |         ->setDraftKey($draft_key) | ||||||
|         ->save(); |         ->save(); | ||||||
|     } catch (AphrontQueryDuplicateKeyException $ex) { |     } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|       // no worries |       // no worries | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -333,7 +333,7 @@ final class HeraldRuleController extends HeraldController { | |||||||
|           $rule->logEdit($request->getUser()->getPHID(), $edit_action); |           $rule->logEdit($request->getUser()->getPHID(), $edit_action); | ||||||
|         $rule->saveTransaction(); |         $rule->saveTransaction(); | ||||||
|  |  | ||||||
|       } catch (AphrontQueryDuplicateKeyException $ex) { |       } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|         $e_name = pht('Not Unique'); |         $e_name = pht('Not Unique'); | ||||||
|         $errors[] = pht('Rule name is not unique. Choose a unique name.'); |         $errors[] = pht('Rule name is not unique. Choose a unique name.'); | ||||||
|       } |       } | ||||||
|   | |||||||
| @@ -125,7 +125,7 @@ final class PhabricatorMacroEditController extends PhabricatorMacroController { | |||||||
|  |  | ||||||
|           $view_uri = $this->getApplicationURI('/view/'.$original->getID().'/'); |           $view_uri = $this->getApplicationURI('/view/'.$original->getID().'/'); | ||||||
|           return id(new AphrontRedirectResponse())->setURI($view_uri); |           return id(new AphrontRedirectResponse())->setURI($view_uri); | ||||||
|         } catch (AphrontQueryDuplicateKeyException $ex) { |         } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|           throw $ex; |           throw $ex; | ||||||
|           $errors[] = pht('Macro name is not unique!'); |           $errors[] = pht('Macro name is not unique!'); | ||||||
|           $e_name = pht('Duplicate'); |           $e_name = pht('Duplicate'); | ||||||
|   | |||||||
| @@ -67,7 +67,7 @@ final class PhabricatorMailingListsEditController | |||||||
|           $list->save(); |           $list->save(); | ||||||
|           return id(new AphrontRedirectResponse()) |           return id(new AphrontRedirectResponse()) | ||||||
|             ->setURI($this->getApplicationURI()); |             ->setURI($this->getApplicationURI()); | ||||||
|         } catch (AphrontQueryDuplicateKeyException $ex) { |         } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|           $e_email = pht('Duplicate'); |           $e_email = pht('Duplicate'); | ||||||
|           $errors[] = pht('Another mailing list already uses that address.'); |           $errors[] = pht('Another mailing list already uses that address.'); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -92,7 +92,7 @@ final class PhabricatorOwnersEditController | |||||||
|           $package->save(); |           $package->save(); | ||||||
|           return id(new AphrontRedirectResponse()) |           return id(new AphrontRedirectResponse()) | ||||||
|             ->setURI('/owners/package/'.$package->getID().'/'); |             ->setURI('/owners/package/'.$package->getID().'/'); | ||||||
|         } catch (AphrontQueryDuplicateKeyException $ex) { |         } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|           $e_name = pht('Duplicate'); |           $e_name = pht('Duplicate'); | ||||||
|           $errors[] = pht('Package name must be unique.'); |           $errors[] = pht('Package name must be unique.'); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -104,7 +104,7 @@ final class PhabricatorPeopleNewController | |||||||
|           $response = id(new AphrontRedirectResponse()) |           $response = id(new AphrontRedirectResponse()) | ||||||
|             ->setURI('/p/'.$user->getUsername().'/'); |             ->setURI('/p/'.$user->getUsername().'/'); | ||||||
|           return $response; |           return $response; | ||||||
|         } catch (AphrontQueryDuplicateKeyException $ex) { |         } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|           $errors[] = pht('Username and email must be unique.'); |           $errors[] = pht('Username and email must be unique.'); | ||||||
|  |  | ||||||
|           $same_username = id(new PhabricatorUser()) |           $same_username = id(new PhabricatorUser()) | ||||||
|   | |||||||
| @@ -56,7 +56,7 @@ final class PhabricatorPeopleRenameController | |||||||
|           $new_uri = '/p/'.$v_username.'/'; |           $new_uri = '/p/'.$v_username.'/'; | ||||||
|  |  | ||||||
|           return id(new AphrontRedirectResponse())->setURI($new_uri); |           return id(new AphrontRedirectResponse())->setURI($new_uri); | ||||||
|         } catch (AphrontQueryDuplicateKeyException $ex) { |         } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|           $e_username = pht('Not Unique'); |           $e_username = pht('Not Unique'); | ||||||
|           $errors[] = pht('Another user already has that username.'); |           $errors[] = pht('Another user already has that username.'); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -54,7 +54,7 @@ final class PhabricatorUserEditor extends PhabricatorEditor { | |||||||
|         $user->save(); |         $user->save(); | ||||||
|         $email->setUserPHID($user->getPHID()); |         $email->setUserPHID($user->getPHID()); | ||||||
|         $email->save(); |         $email->save(); | ||||||
|       } catch (AphrontQueryDuplicateKeyException $ex) { |       } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|         // We might have written the user but failed to write the email; if |         // We might have written the user but failed to write the email; if | ||||||
|         // so, erase the IDs we attached. |         // so, erase the IDs we attached. | ||||||
|         $user->setID(null); |         $user->setID(null); | ||||||
| @@ -155,7 +155,7 @@ final class PhabricatorUserEditor extends PhabricatorEditor { | |||||||
|  |  | ||||||
|       try { |       try { | ||||||
|         $user->save(); |         $user->save(); | ||||||
|       } catch (AphrontQueryDuplicateKeyException $ex) { |       } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|         $user->setUsername($old_username); |         $user->setUsername($old_username); | ||||||
|         $user->killTransaction(); |         $user->killTransaction(); | ||||||
|         throw $ex; |         throw $ex; | ||||||
| @@ -365,7 +365,7 @@ final class PhabricatorUserEditor extends PhabricatorEditor { | |||||||
|  |  | ||||||
|         try { |         try { | ||||||
|           $email->save(); |           $email->save(); | ||||||
|         } catch (AphrontQueryDuplicateKeyException $ex) { |         } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|           $user->endWriteLocking(); |           $user->endWriteLocking(); | ||||||
|           $user->killTransaction(); |           $user->killTransaction(); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -25,7 +25,7 @@ final class PhabricatorPeopleTestDataGenerator | |||||||
|           ->createNewUser($user, $email_object); |           ->createNewUser($user, $email_object); | ||||||
|  |  | ||||||
|         return $user; |         return $user; | ||||||
|       } catch (AphrontQueryDuplicateKeyException $ex) { |       } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -96,7 +96,7 @@ final class PhameBlogEditController | |||||||
|           $blog->save(); |           $blog->save(); | ||||||
|           return id(new AphrontRedirectResponse()) |           return id(new AphrontRedirectResponse()) | ||||||
|             ->setURI($this->getApplicationURI('blog/view/'.$blog->getID().'/')); |             ->setURI($this->getApplicationURI('blog/view/'.$blog->getID().'/')); | ||||||
|         } catch (AphrontQueryDuplicateKeyException $ex) { |         } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|           $errors[] = pht('Domain must be unique.'); |           $errors[] = pht('Domain must be unique.'); | ||||||
|           $e_custom_domain = pht('Not Unique'); |           $e_custom_domain = pht('Not Unique'); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -82,7 +82,7 @@ final class PhamePostEditController extends PhameController { | |||||||
|  |  | ||||||
|           $uri = $this->getApplicationURI('/post/view/'.$post->getID().'/'); |           $uri = $this->getApplicationURI('/post/view/'.$post->getID().'/'); | ||||||
|           return id(new AphrontRedirectResponse())->setURI($uri); |           return id(new AphrontRedirectResponse())->setURI($uri); | ||||||
|         } catch (AphrontQueryDuplicateKeyException $e) { |         } catch (AphrontDuplicateKeyQueryException $e) { | ||||||
|           $e_phame_title = pht('Not Unique'); |           $e_phame_title = pht('Not Unique'); | ||||||
|           $errors[]      = pht('Another post already uses this slug. '. |           $errors[]      = pht('Another post already uses this slug. '. | ||||||
|                            'Each post must have a unique slug.'); |                            'Each post must have a unique slug.'); | ||||||
|   | |||||||
| @@ -92,7 +92,7 @@ final class PhluxEditController extends PhluxController { | |||||||
|           $editor->applyTransactions($var, $xactions); |           $editor->applyTransactions($var, $xactions); | ||||||
|           $view_uri = $this->getApplicationURI('/view/'.$key.'/'); |           $view_uri = $this->getApplicationURI('/view/'.$key.'/'); | ||||||
|           return id(new AphrontRedirectResponse())->setURI($view_uri); |           return id(new AphrontRedirectResponse())->setURI($view_uri); | ||||||
|         } catch (AphrontQueryDuplicateKeyException $ex) { |         } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|           $e_key = pht('Not Unique'); |           $e_key = pht('Not Unique'); | ||||||
|           $errors[] = pht('Variable key must be unique.'); |           $errors[] = pht('Variable key must be unique.'); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -52,7 +52,7 @@ final class PhragmentSnapshotCreateController extends PhragmentController { | |||||||
|             ->setPrimaryFragmentPHID($fragment->getPHID()) |             ->setPrimaryFragmentPHID($fragment->getPHID()) | ||||||
|             ->setName($v_name) |             ->setName($v_name) | ||||||
|             ->save(); |             ->save(); | ||||||
|         } catch (AphrontQueryDuplicateKeyException $e) { |         } catch (AphrontDuplicateKeyQueryException $e) { | ||||||
|           $errors[] = pht('A snapshot with this name already exists.'); |           $errors[] = pht('A snapshot with this name already exists.'); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -44,7 +44,7 @@ final class ReleephProductCreateController extends ReleephProductController { | |||||||
|  |  | ||||||
|           return id(new AphrontRedirectResponse()) |           return id(new AphrontRedirectResponse()) | ||||||
|             ->setURI($releeph_product->getURI()); |             ->setURI($releeph_product->getURI()); | ||||||
|         } catch (AphrontQueryDuplicateKeyException $ex) { |         } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|           $e_name = pht('Not Unique'); |           $e_name = pht('Not Unique'); | ||||||
|           $errors[] = pht('Another product already uses this name.'); |           $errors[] = pht('Another product already uses this name.'); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -134,7 +134,7 @@ final class RepositoryCreateConduitAPIMethod | |||||||
|  |  | ||||||
|     try { |     try { | ||||||
|       $repository->save(); |       $repository->save(); | ||||||
|     } catch (AphrontQueryDuplicateKeyException $ex) { |     } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|       throw new ConduitException('ERR-DUPLICATE'); |       throw new ConduitException('ERR-DUPLICATE'); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -632,7 +632,7 @@ final class PhabricatorRepositoryDiscoveryEngine | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     } catch (AphrontQueryDuplicateKeyException $ex) { |     } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|       $commit->killTransaction(); |       $commit->killTransaction(); | ||||||
|       // Ignore. This can happen because we discover the same new commit |       // Ignore. This can happen because we discover the same new commit | ||||||
|       // more than once when looking at history, or because of races or |       // more than once when looking at history, or because of races or | ||||||
|   | |||||||
| @@ -59,7 +59,7 @@ final class PhabricatorSearchController | |||||||
|           $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); |           $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); | ||||||
|             try { |             try { | ||||||
|               $saved->setID(null)->save(); |               $saved->setID(null)->save(); | ||||||
|             } catch (AphrontQueryDuplicateKeyException $ex) { |             } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|               // Ignore, this is just a repeated search. |               // Ignore, this is just a repeated search. | ||||||
|             } |             } | ||||||
|           unset($unguarded); |           unset($unguarded); | ||||||
|   | |||||||
| @@ -52,7 +52,7 @@ abstract class PhabricatorApplicationSearchEngine { | |||||||
|     $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); |     $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); | ||||||
|     try { |     try { | ||||||
|       $query->save(); |       $query->save(); | ||||||
|     } catch (AphrontQueryDuplicateKeyException $ex) { |     } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|       // Ignore, this is just a repeated search. |       // Ignore, this is just a repeated search. | ||||||
|     } |     } | ||||||
|     unset($unguarded); |     unset($unguarded); | ||||||
|   | |||||||
| @@ -210,7 +210,7 @@ final class PhabricatorSettingsPanelEmailAddresses | |||||||
|             ->addSubmitButton(pht('Done')); |             ->addSubmitButton(pht('Done')); | ||||||
|  |  | ||||||
|           return id(new AphrontDialogResponse())->setDialog($dialog); |           return id(new AphrontDialogResponse())->setDialog($dialog); | ||||||
|         } catch (AphrontQueryDuplicateKeyException $ex) { |         } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|           $email = pht('Duplicate'); |           $email = pht('Duplicate'); | ||||||
|           $errors[] = pht('Another user already has this email.'); |           $errors[] = pht('Another user already has this email.'); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -103,7 +103,7 @@ final class PhabricatorSettingsPanelSSHKeys | |||||||
|           $key->save(); |           $key->save(); | ||||||
|           return id(new AphrontRedirectResponse()) |           return id(new AphrontRedirectResponse()) | ||||||
|             ->setURI($this->getPanelURI()); |             ->setURI($this->getPanelURI()); | ||||||
|         } catch (AphrontQueryDuplicateKeyException $ex) { |         } catch (AphrontDuplicateKeyQueryException $ex) { | ||||||
|           $e_key = pht('Duplicate'); |           $e_key = pht('Duplicate'); | ||||||
|           $errors[] = pht('This public key is already associated with a user '. |           $errors[] = pht('This public key is already associated with a user '. | ||||||
|                       'account.'); |                       'account.'); | ||||||
|   | |||||||
| @@ -134,7 +134,7 @@ final class AphrontIsolatedDatabaseConnectionTestCase | |||||||
|         null, |         null, | ||||||
|         $row, |         $row, | ||||||
|         'Expect fake row to exist only in isolation.'); |         'Expect fake row to exist only in isolation.'); | ||||||
|     } catch (AphrontQueryConnectionException $ex) { |     } catch (AphrontConnectionQueryException $ex) { | ||||||
|       // If we can't connect to the database, conclude that the isolated |       // If we can't connect to the database, conclude that the isolated | ||||||
|       // connection actually is isolated. Philosophically, this perhaps allows |       // connection actually is isolated. Philosophically, this perhaps allows | ||||||
|       // us to claim this test does not depend on the database? |       // us to claim this test does not depend on the database? | ||||||
|   | |||||||
| @@ -28,7 +28,7 @@ final class AphrontMySQLDatabaseConnectionTestCase | |||||||
|       $caught = null; |       $caught = null; | ||||||
|       try { |       try { | ||||||
|         queryfx($conn, 'SELECT 1'); |         queryfx($conn, 'SELECT 1'); | ||||||
|       } catch (AphrontQueryConnectionLostException $ex) { |       } catch (AphrontConnectionLostQueryException $ex) { | ||||||
|         $caught = $ex; |         $caught = $ex; | ||||||
|       } |       } | ||||||
|       $this->assertTrue($caught instanceof Exception); |       $this->assertTrue($caught instanceof Exception); | ||||||
|   | |||||||
| @@ -460,7 +460,7 @@ abstract class LiskDAO { | |||||||
|       $args); |       $args); | ||||||
|  |  | ||||||
|     if (count($data) > 1) { |     if (count($data) > 1) { | ||||||
|       throw new AphrontQueryCountException( |       throw new AphrontCountQueryException( | ||||||
|         'More than 1 result from loadOneWhere()!'); |         'More than 1 result from loadOneWhere()!'); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -517,7 +517,7 @@ abstract class LiskDAO { | |||||||
|       $this->getID()); |       $this->getID()); | ||||||
|  |  | ||||||
|     if (!$result) { |     if (!$result) { | ||||||
|       throw new AphrontQueryObjectMissingException(); |       throw new AphrontObjectMissingQueryException(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     return $this; |     return $this; | ||||||
| @@ -771,7 +771,7 @@ abstract class LiskDAO { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (count($relatives) > 1) { |     if (count($relatives) > 1) { | ||||||
|       throw new AphrontQueryCountException( |       throw new AphrontCountQueryException( | ||||||
|         'More than 1 result from loadOneRelative()!'); |         'More than 1 result from loadOneRelative()!'); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -1183,7 +1183,7 @@ abstract class LiskDAO { | |||||||
|         } else { |         } else { | ||||||
|           $data[$key] = qsprintf($conn, '%ns', $value); |           $data[$key] = qsprintf($conn, '%ns', $value); | ||||||
|         } |         } | ||||||
|       } catch (AphrontQueryParameterException $parameter_exception) { |       } catch (AphrontParameterQueryException $parameter_exception) { | ||||||
|         throw new PhutilProxyException( |         throw new PhutilProxyException( | ||||||
|           pht( |           pht( | ||||||
|             "Unable to insert or update object of class %s, field '%s' ". |             "Unable to insert or update object of class %s, field '%s' ". | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Joshua Spence
					Joshua Spence