-
Notifications
You must be signed in to change notification settings - Fork 3
Improve the error messages for command I/O errors #356
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
Conversation
Similar to #355 but for I/O errors from spawning a `Command` instead of from file operations. Such Command I/O errors are only likely to happen in the case of a bug, so the error message now says as much. The error also now generates the program name from the command, so avoid it getting out of sync. The command's args are intentionally omitted, since they aren't relevant for errors that occur when spawning a command. (ie: For command not found, it's the program that's not found, not the args.) GUS-W-12650236.
6f8b54a to
dd4b1ae
Compare
schneems
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Comments, no request for changes:
- For debugging these failures, I wrote https://github.com/schneems/which_problem but haven't touched it in a long time. (An FYI if you're interested in poking at it or improving it).
- Re the message in the commit: If you moved this into a different module and changed the visibility, you could guarantee that the string came from an
&mut Commandby forcing programmers to go through your interface:
pub(crate) struct CommandIoError {
program: String,
io_error: io::Error,
}
impl CommandIoError {
pub(crate) fn new(command: &mut Command, io_error: io::Error) -> Self {
Self {
program: command.get_program().to_string_lossy().to_string(),
io_error,
}
}
pub(crate) fn program(&self) -> &str {
&self.program
}
pub(crate) fn io_error(&self) -> &io::Error {
&self.io_error
}
}Not needed, just mentioning an alternative.
Yeah I'd glanced at it a while back - the reason I'm not using it here, is that these Command I/O errors are: ...so we don't need the full feature-set supported by the ...vs the <20 lines of implementation here. For projects that need the full feature-set of |
## heroku/python ### Removed - Removed support for the deprecated `runtime.txt` file. Python versions must now be specified using a `.python-version` file instead. ([#352](#352)) - Removed support for Ubuntu 20.04 (and thus Heroku-20 / `heroku/builder:20`). ([#358](#358)) ### Changed - Improved the error messages shown when `.python-version` contains an invalid Python version or stray invisible characters (such as ASCII control codes). ([#353](#353) and [#354](#354)) - Improved the error messages shown if I/O errors occur. ([#355](#355) and [#356](#356))
## heroku/python ### Removed - Removed support for the deprecated `runtime.txt` file. Python versions must now be specified using a `.python-version` file instead. ([#352](heroku/buildpacks-python#352)) - Removed support for Ubuntu 20.04 (and thus Heroku-20 / `heroku/builder:20`). ([#358](heroku/buildpacks-python#358)) ### Changed - Improved the error messages shown when `.python-version` contains an invalid Python version or stray invisible characters (such as ASCII control codes). ([#353](heroku/buildpacks-python#353) and [#354](heroku/buildpacks-python#354)) - Improved the error messages shown if I/O errors occur. ([#355](heroku/buildpacks-python#355) and [#356](heroku/buildpacks-python#356))
Similar to #355 but for I/O errors from spawning a
Commandinstead of from file operations.Such Command I/O errors are only likely to happen in the case of a bug, so the error message now says as much. The error also now generates the program name from the command, so avoid it getting out of sync. The command's args are intentionally omitted, since they aren't relevant for errors that occur when spawning a command. (ie: For command not found, it's the program that's not found, not the args.)
GUS-W-12650236.