Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c55c01fe authored by Akhil's avatar Akhil 🙂
Browse files

nested try-catch instead of no exception

parent 442dc6e2
Loading
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -189,9 +189,14 @@ class AccountController extends Controller {
			$userEmail = $username.'@'.$mainDomain;
			$this->userService->registerUser($displayname, $recoveryEmail, $username, $userEmail, $password, $language);
			sleep(5);
			try {
				// Don't want this operation to block the rest of registration logic
				// so we need a nested try-catch
				$ipAddress = $this->request->getRemoteAddress();
				$this->userService->addUsernameToCommonDataStore($username, $ipAddress, $recoveryEmail);

			} catch (\Throwable $e) {
				$this->logger->logException($e, ['app' => Application::APP_ID]);
			}
			$this->userService->setAccountDataLocally($username, $userEmail);
			$this->userService->createHMEAlias($username, $userEmail);
			$this->userService->createNewDomainAlias($username, $userEmail);
+1 −4
Original line number Diff line number Diff line
@@ -472,10 +472,7 @@ class UserService {
		$this->curl->post($url, $params, $headers);

		if ($this->curl->getLastStatusCode() !== 200) {
			$this->logger->logException(
				new AddUsernameToCommonStoreException("Error adding username '$username' to common data store."),
				['app' => Application::APP_ID]
			);
			throw new AddUsernameToCommonStoreException("Error adding username '$username' to common data store.");
		}
	}