Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(error messages): fix error messages when downloading the config (#…
…6024) This was missed, but #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 * use the #[source] attribute instead of directly formatting errors and store a PathBuf instead of a String for paths in error variants
- Loading branch information