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
utils: Disambiguate between normal and malformed EOF in nix::readLine. #1485
base: master
Are you sure you want to change the base?
Conversation
Going back through my old PRs....I guess this is still probably a good idea? |
I marked this as stale due to inactivity. → More info |
I closed this issue due to inactivity. → More info |
a4b85ab
to
20671dd
Compare
if (s == "") | ||
return std::nullopt; | ||
else | ||
throw EndOfFile("unexpected end-of-file while reading line"); |
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.
end-of-file
is usually used in error messages, rather than EOF.
I rebased this, and split the function to make the intent clearer. |
@Ericson2314 do you have an example of “normal” and “malformed” EOFs? Not sure what the distinction means |
All mark this draft until I have a test. It is a very old PR :). The issue was a lack of a trailing newline I think. |
This little change was extracted from my old version of #1480. I figure it is good the user to get a better error message, and at some later point we can also use
optional
and clean up use sites.WIP still need to build/test.