mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
updater: Minor improvements to error handling
In RequestsFetcher it makes sense to raise "from e" but in updater the error we raise is not related to the original error: use "from None". Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
This commit is contained in:
parent
27cc46f61d
commit
289950a17c
2 changed files with 2 additions and 2 deletions
|
|
@ -94,7 +94,7 @@ def _fetch(self, url: str) -> Iterator[bytes]:
|
|||
except requests.HTTPError as e:
|
||||
response.close()
|
||||
status = e.response.status_code
|
||||
raise exceptions.DownloadHTTPError(str(e), status)
|
||||
raise exceptions.DownloadHTTPError(str(e), status) from e
|
||||
|
||||
return self._chunks(response)
|
||||
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ def _load_targets(self, role: str, parent_role: str) -> Targets:
|
|||
if metainfo is None:
|
||||
raise exceptions.RepositoryError(
|
||||
f"Role {role} was delegated but is not part of snapshot"
|
||||
)
|
||||
) from None
|
||||
|
||||
length = metainfo.length or self.config.targets_max_length
|
||||
version = None
|
||||
|
|
|
|||
Loading…
Reference in a new issue