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

fix(error messages): fix error messages when downloading the config #6024

Merged
merged 4 commits into from Jan 7, 2022

Commits on Jan 7, 2022

  1. fix(error messages): fix error messages when downloading the config g…

    …oes wrong
    
    This was missed, but near#5967 did
    not interact very well with `enum FileDownloadError`, so this is an
    attempt to fix that, and present better error messages.
    
    The reason for getting rid of the #[from] in the HttpError variant is
    that it doesn't really play nicely with the anyhow {:#} formatter and
    gives us ugliness like:
    
    ERROR neard::cli: Failed to initialize configs: Failed to download the config file from http://localhost:8002/config.json: error trying to connect: tcp connect error: Connection refused (os error 111): tcp connect error: Connection refused (os error 111): Connection refused (os error 111)
    
    Test Plan:
    Of course check that downloading the file still works, but also inject
    errors and make sure the error messages look ok. For reviewer
    convenience, error msgs corresponding to the variants below (except
    for RemoveTemporaryFileError. Didn't get to that one... but I think
    it's probably good)
    
    HttpError:
    
    ERROR neard::cli: Failed to initialize configs: Failed to download the config file from http://localhost:8002/config.json: error trying to connect: tcp connect error: Connection refused (os error 111)
    
    OpenError:
    
    ERROR neard::cli: Failed to initialize configs: Failed to download the config file from http://localhost:8002/config.json: Failed to open temporary file: No such file or directory (os error 2) at path "/asdf/.tmp2g9Pqe"
    
    WriteError:
    
    ERROR neard::cli: Failed to initialize configs: Failed to download the config file from http://localhost:8000/config.json: Failed to write to temporary file at /tmp/asdfa/.tmpNdy4iL: Bad file descriptor (os error 9)
    
    RenameEror:
    
    ERROR neard::cli: Failed to initialize configs: Failed to download the config file from http://localhost:8000/config.json: Failed to rename temporary file /tmp/asdfa/.tmpRvBBEn to /tmp/asdfa/config.json : Permission denied (os error 13)
    
    UriError:
    
    ERROR neard::cli: Failed to initialize configs: Failed to download the config file from http://localhost:8002:3:a:b/config.json: Invalid URI: invalid authority
    marcelo-gonzalez committed Jan 7, 2022
    Copy the full SHA
    6cc2fdc View commit details
    Browse the repository at this point in the history
  2. use the #[source] attribute instead of directly formatting errors

    and store a PathBuf instead of a String for paths in error variants
    marcelo-gonzalez committed Jan 7, 2022
    Copy the full SHA
    86a3654 View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    a86ef39 View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    0ebb6f2 View commit details
    Browse the repository at this point in the history