Network(ish) error messages

I’m looking at making network- and server-related error messages be less scary. Currently for example if the store returns a 503 we’d print a rather unfriendly message, for example

$ snap install hello-world
error: cannot install "hello-world": cannot get details for snap "hello-world" in channel "stable":
       got unexpected HTTP status code 503 via GET to
       "https://search.apps.ubuntu.com/api/v1/snaps/details/hello-world?channel=stable&fields=anon_download_url%2Carchitecture%2Cchannel%2Cdownload_sha3_384%2Csummary%2Cdescription%2Cdeltas%2Cbinary_filesize%2Cdownload_url%2Cepoch%2Cicon_url%2Clast_updated%2Cpackage_name%2Cprices%2Cpublisher%2Cratings_average%2Crevision%2Cscreenshot_urls%2Csnap_id%2Csupport_url%2Ccontact%2Ctitle%2Ccontent%2Cversion%2Corigin%2Cdeveloper_id%2Cprivate%2Cconfinement%2Cchannel_maps_list"

I’d like to move to logging this (with INFO, i.e. not just in debug), and presenting the user with the minimum accurate (but not necessarily complete) message instead. For example,

$ snap install hello-world
error: cannot install "hello-world": server trouble

and if it’s something like a DNS error,

$ snap install hello-world
error: cannot install "hello-world": network trouble

it could be tweaked to have slightly different wording depending on whether we’re trying to contact CPI or SSO or CUD, but I’m not sure it’s worth it because it won’t give a regular user more information, and a developer looking to debug it will go to the journal entry anyway. Similarly it could be made slightly more verbose by including e.g. (503), but again, not sure it’s worth it for the same reason.

1 Like

Improving these errors would be great, but ideally we’d do that without losing the key hints that allow us to dig into the problem. For example, without thinking of the implementation details:

$ snap install hello-world
error: cannot install "hello-world": store problem (503 at details endpoint)

and

snap install hello-world
error: cannot install "hello-world": network seems offline (DNS problem)