Skip to content

ngclient: decide what to do with requests (Fetcher impl) errors #1714

Closed

Description

@jku

I wonder if we should handle all exceptions thrown by Fetcher implementations (and throw a generic error that clients can actually handle)?

This issue can be tested with examples/client_example/client_example.py: if e.g. server is not running there's a requests ConnectionError. All requests errors do derive from OSError so it gets handled by the example code but another fetcher implementation might not do the same.

Alternatively we can just say that Fetcher implementations should document what gets thrown (and requestsFetcher could just link to RequestException)

Activity

  1. jku commented on Jan 12, 2022

    @jku
    MemberAuthor

    I think Fetcher should handle all exceptions, and raise a FetcherError which should derive from DownloadError -- this means client can just handle DownloadError which is what they probably want

  2. added
    1.0.0 blockers
    on Jan 12, 2022
  3. self-assigned this
    on Jan 26, 2022
  4. added this to the sprint 16 milestone on Jan 26, 2022
  5. jku commented on Jan 31, 2022

    @jku
    MemberAuthor

    Actually, there is no need for separate DownloadError and FetcherError: they are one and same (all DownloadErrors come from fetcher). We just need to document the fetcherinterface so that the methods are only allowed to raise DownloadErrors and derivatives -- or handle that in the interface itself. RequestsFetcher needs a small modification so fetch() actually enforces this requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

1.0.0 blockersngclient

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions