-
Notifications
You must be signed in to change notification settings - Fork 273
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
Review and document ngclient exceptions #1787
Review and document ngclient exceptions #1787
Conversation
We no longer need to catch LengthOrHashMismatchError and reraise a RepositoryError as LengthOrHashMismatchError is changed to inherit RepositoryError. Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
@lukpueh can you investigate why still there are required CI builds for |
Pull Request Test Coverage Report for Build 1756233091
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO the raise message is more straightforward than the docstring for RuntimeError
in the functions.
But I'm still unable to get better suggestions (Sorry), maybe more detailed information as the raising messages?
Do you mean that the rest of the documentation regarding exceptions in |
What I mean is that messages raises are more straightforward than the one in the docstrings. raise RuntimeError("Cannot update timestamp after snapshot")
raise RuntimeError("Cannot update snapshot before timestamp")
raise RuntimeError("Cannot update snapshot after targets")
raise RuntimeError("Cannot load targets before snapshot")
raise RuntimeError("Cannot load targets before delegator") Maybe it is my interpretation, but reading the raised messages (not the code logic) gives me more details than the documentation. |
Oh sure. I had to kick out the 3.6 checks in the branch protection rules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the core choices here: figuring out if we really cover everything with the exceptions docstrings is really hard but I couldn't find anything where I disagreed with you.
lefty some very nitpicky comments (which are really up to you), and then the one about writing the file: raising OSError manually feels wrong... I'd rather we skip the securesystemslib function call altogether.
4ba8751
to
6403d13
Compare
6403d13
to
473a869
Compare
I made a review on all files inside tuf/ngclient to see which of them needs additions or changes in their function docstrings regarding exceptions. I didn't find any changes required inside the request_fetcher.py and of course inside the config module. Other than that multiple additions had to be made. For trusted_metadata_set we had a discussion with Jussi that there is no need to list each of the specific RepositoryErrors one by one as this is an internal module and this will only create a bigger maintenance burden. For updater.py we had discussions with Jussi and Lukas that we want to document only those exceptions that could be potentially handled. This means there is no point in documenting each of the RepositoryErrors or DownloadErrors separately. Finally, I added a little documentation for download_bytes() inside fetcher.py, as it's naming, suggests it's not an internal function. Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
473a869
to
9f7866d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks.
Fixes #1312
Description of the changes being introduced by the pull request:
I made a review on all files inside
tuf/ngclient
to see which of themneeds additions or changes in their function docstrings regarding
exceptions.
I didn't find any changes required inside the
request_fetcher.py
and of course inside the config module.
Other than that multiple additions had to be made.
For
trusted_metadata_set.py
we had a discussion with Jussi that there isno need to list each of the specific
RepositoryError
s one by one asthis is an internal module and this will only create a bigger
maintenance burden.
For
updater.py
we had discussions with Jussi and Lukas that we want todocument only those exceptions that could be potentially handled.
This means there is no point in documenting each of the
RepositoryError
sor
DownloadError
s separately.Finally, I added a little documentation for
download_bytes()
insidefetcher.py
, as it's naming, suggests it's not an internal function.Signed-off-by: Martin Vrachev mvrachev@vmware.com
Please verify and check that the pull request fulfills the following
requirements: