diff --git a/ecosystem/daos/dao.py b/ecosystem/daos/dao.py index 301395c5b5..b5e3776c29 100644 --- a/ecosystem/daos/dao.py +++ b/ecosystem/daos/dao.py @@ -118,14 +118,11 @@ def delete(self, repo_url: str): def get_by_url(self, url: str) -> Repository: """ Returns repository by URL. - - Args: - repo_url: repository url """ - try: - return self.storage.read()[url] - except KeyError as err: - raise KeyError(f"No repo with URL '{url}'") from err + data = self.storage.read() + if url not in data: + raise KeyError(f"No repo with URL '{url}'") + return self.storage.read()[url] def update(self, repo_url: str, **kwargs): """