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

review/document client exceptions #1312

Closed
sechkova opened this issue Mar 12, 2021 · 4 comments · Fixed by #1787
Closed

review/document client exceptions #1312

sechkova opened this issue Mar 12, 2021 · 4 comments · Fixed by #1787
Assignees
Labels
1.0.0 blockers To be addressed before 1.0.0 release backlog Issues to address with priority for current development goals documentation Documentation of the project as well as procedural documentation ngclient
Milestone

Comments

@sechkova
Copy link
Contributor

sechkova commented Mar 12, 2021

Description of issue or feature request:
Revise and implements client exceptions handling

Current behavior:
Not all thrown exceptions are documented or handled by the client.

Expected behavior:
Implement proper exception handling and document the API

Sync with #1131

@sechkova sechkova added the experimental-client Items related to the development of a new client (see milestone/8 and theexperimental-client branch) label Mar 12, 2021
@sechkova sechkova added this to the Client Refactor milestone Mar 12, 2021
@sechkova sechkova mentioned this issue Mar 12, 2021
17 tasks
sechkova added a commit to sechkova/tuf that referenced this issue Mar 23, 2021
Temporary disable (inline) try-except-raise and broad-except
warnings until client exception handling is revised (theupdateframework#1312).

Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
sechkova added a commit to sechkova/tuf that referenced this issue Mar 23, 2021
Temporary disable (inline) try-except-raise and broad-except
warnings until client exception handling is revised (theupdateframework#1312).

Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
sechkova added a commit to sechkova/tuf that referenced this issue Mar 23, 2021
Temporary disable (inline) try-except-raise and broad-except
warnings until client exception handling is revised (theupdateframework#1312).

Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
sechkova added a commit to sechkova/tuf that referenced this issue Mar 24, 2021
Temporary disable (inline) try-except-raise and broad-except
warnings in the new Updater code until client exception handling
is revised (theupdateframework#1312).

Signed-off-by: Teodora Sechkova <tsechkova@vmware.com>
@jku
Copy link
Member

jku commented May 12, 2021

The major items here are probably:

  • bundle (once it's in) should only raise RepositoryError (or anyway a single base error representing failures because remote provided metadata we can't cope with) and user errors like ValueError
  • since we removed mirrors, we can longer hide behind NoWorkingMirror -- need to figure out a nice solution. This probably still involves at least one wrapper error as we may get random errors from whatever Fetcher is being used

@jku
Copy link
Member

jku commented May 17, 2021

After doing the metadata bundle integration, I think our client exceptions should be grouped like this:

  • RepositoryErrors (various): something is wrong with metadata. In some cases this can be handled within client (like in the case of local metadata being no longer signed by correct keys), but in many cases this is an external exception
  • OSErrors (various): Failures to read or write local metadata
  • RuntimeErrors/ValueErrors/etc: errors that mean API misuse (code should be fixed, exception should not be handled)
  • some kind of generic download error: We should define an error that download functions return, wrapping whatever error the FetcherInterface implementation raises. This way the updater public API has a specific error for download failures

@jku jku added the ngclient label May 21, 2021
@sechkova sechkova added backlog Issues to address with priority for current development goals and removed experimental-client Items related to the development of a new client (see milestone/8 and theexperimental-client branch) labels May 21, 2021
@joshuagl joshuagl removed this from the Experimental client milestone May 26, 2021
@jku
Copy link
Member

jku commented Sep 1, 2021

My impression is that ngclient exceptions are in a pretty good state by now, but review would be good:

  • see what exceptions are handled in code using ngclient (like tests)
  • review ngclient/trustedmetadataset and see if exceptions seem to make sense

In addition to a review, we should document how ngclient uses exceptions: mostly that RepositoryError is used as a catch all for fatal update errors -- a metadata state that clients cannot recover from, but where a later update (after the remote updates metadata) might succeed.

@jku jku changed the title Revise client exceptions review/document client exceptions Oct 1, 2021
@jku
Copy link
Member

jku commented Oct 1, 2021

Updated title: I think we're mostly missing proper documentation:

  • document our own exceptions
  • document OSErrors where necessary (anytime we read or write files)

@jku jku added the documentation Documentation of the project as well as procedural documentation label Oct 1, 2021
@jku jku mentioned this issue Oct 1, 2021
4 tasks
@MVrachev MVrachev added the 1.0.0 blockers To be addressed before 1.0.0 release label Jan 11, 2022
@MVrachev MVrachev self-assigned this Jan 12, 2022
@MVrachev MVrachev added this to the Sprint 15 milestone Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.0.0 blockers To be addressed before 1.0.0 release backlog Issues to address with priority for current development goals documentation Documentation of the project as well as procedural documentation ngclient
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants