Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch HacsException in common_update #2446

Merged
merged 2 commits into from
Jan 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions custom_components/hacs/repositories/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,10 @@ async def common_update(self, ignore_issues=False, force=False) -> bool:
self.data.full_name = self.hacs.common.renamed_repositories[self.data.full_name]
await self.common_update_data(ignore_issues=ignore_issues, force=force)

except HacsException:
if not ignore_issues and not force:
return False

if not self.data.installed and (current_etag == self.data.etag_repository) and not force:
self.logger.debug("Did not update %s, content was not modified", self.data.full_name)
return False
Expand Down Expand Up @@ -943,12 +947,12 @@ async def common_update_data(self, ignore_issues: bool = False, force: bool = Fa
self.validate.errors.append("Repository is archived.")
if self.data.full_name not in self.hacs.common.archived_repositories:
self.hacs.common.archived_repositories.append(self.data.full_name)
raise HacsRepositoryArchivedException("Repository is archived.")
raise HacsRepositoryArchivedException(f"{self} Repository is archived.")

# Make sure the repository is not in the blacklist.
if self.hacs.repositories.is_removed(self.data.full_name) and not ignore_issues:
self.validate.errors.append("Repository is in the blacklist.")
raise HacsException("Repository is in the blacklist.")
self.validate.errors.append("Repository has been requested to be removed.")
raise HacsException(f"{self} Repository has been requested to be removed.")

# Get releases.
try:
Expand Down