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

Unverified Commit 262caf41 authored by Akhil's avatar Akhil
Browse files

Handle exception in method call

parent 90097016
Loading
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -147,8 +147,13 @@ class AccountController extends Controller {
		}

		$this->session->remove(self::SESSION_USERNAME_CHECK);
		$this->userService->addUsernameToCommonDataStore($username);
		$this->session->remove(self::CAPTCHA_VERIFIED_CHECK);

		try {
			$this->userService->addUsernameToCommonDataStore($username);
		} catch (Exception $e) {
			$this->logger->logException($e, ['app' => Application::APP_ID]);
		}
		return $response;
	}
	/**
+3 −9
Original line number Diff line number Diff line
@@ -442,16 +442,10 @@ class UserService {
			"Authorization: Bearer $token"
		];
		
		try {
		$this->curl->post($url, $params, $headers);

		if ($this->curl->getLastStatusCode() !== 200) {
				throw new Exception();
			}
		} catch (Exception $e) {
			$this->logger->error('Error adding username ' . $username . ' to common data store');
			throw new Exception('Error adding username ' . $username . ' to common data store');
		}
		

	}
}