Skip to content

Commit

Permalink
Remove try catch clause from verify func
Browse files Browse the repository at this point in the history
  • Loading branch information
kokerinks committed Jul 8, 2024
1 parent 4dd31db commit 846bfc1
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/app/core/services/view.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,13 @@ export class ViewService {
(await this.githubService.isOrganisationPresent(owner).toPromise()) ||
(await this.githubService.isUsernamePresent(owner).toPromise());
if (!isValidOwner) {
this.isChangingRepo.next(false);
throw new Error(ErrorMessageService.repoOwnerNotPresentMessage());
}

const isValidRepository = await this.githubService.isRepositoryPresent(owner, repo).toPromise();
if (!isValidRepository) {
this.isChangingRepo.next(false);
throw new Error(ErrorMessageService.repositoryNotPresentMessage());
}

Expand All @@ -142,13 +144,8 @@ export class ViewService {
* @throws Error if the repository is not valid
*/
async changeRepositoryIfValid(repo: Repo) {
try {
this.isChangingRepo.next(true);
await this.verifyOwnerAndRepo(repo.owner, repo.name);
} catch (error) {
this.isChangingRepo.next(false);
throw error;
}
this.isChangingRepo.next(true);
await this.verifyOwnerAndRepo(repo.owner, repo.name);
this.changeCurrentRepository(repo);
this.isChangingRepo.next(false);
}
Expand Down

0 comments on commit 846bfc1

Please sign in to comment.