You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve the error messages for file I/O errors (#355)
This improves the error messages shown for file related I/O errors,
by:
- ensuring that the path is always included
- adding additional suggestions to the error based on the context
(which is now known, since specialised types are used for each of
the common scenarios like checking if a file exists or reading a
file to a string)
We're able to make the errors richer than those provided by `fs-err`,
since we know the context in which the errors have occurred.
For example, in the error message for `ReadOptionalFileError`s we know
not to say to check for a missing file or that the file is a directory,
since `read_optional_file()` explicitly excludes those cases by design.
If we used `io::Error` (or `fs-err`'s equivalent) we would have to rely
on the user not using the wrong logging function for the wrong I/O error
case, rather than relying on the type system to do that for us.
These changes leave `log_io_error()` as being used only for the
`Command` I/O cases. A later PR will switch adjust those usages too
(but this PR is already large enough).
Closes#270.
GUS-W-12650236.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
14
14
### Changed
15
15
16
16
- Improved the error messages shown when `.python-version` contains an invalid Python version or stray invisible characters (such as ASCII control codes). ([#353](https://github.com/heroku/buildpacks-python/pull/353) and [#354](https://github.com/heroku/buildpacks-python/pull/354))
17
+
- Improved the error messages shown if I/O errors occur. ([#355](https://github.com/heroku/buildpacks-python/pull/355))
0 commit comments