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

utils: Disambiguate between normal and malformed EOF in nix::readLine. #1485

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ericson2314
Copy link
Member

@Ericson2314 Ericson2314 commented Jul 24, 2017

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.

@Ericson2314
Copy link
Member Author

Going back through my old PRs....I guess this is still probably a good idea?

@stale
Copy link

stale bot commented Mar 5, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Mar 5, 2021
@stale
Copy link

stale bot commented Apr 16, 2022

I closed this issue due to inactivity. → More info

@stale stale bot closed this Apr 16, 2022
@Ericson2314 Ericson2314 reopened this Apr 19, 2022
@stale stale bot removed the stale label Apr 19, 2022
if (s == "")
return std::nullopt;
else
throw EndOfFile("unexpected end-of-file while reading line");
Copy link
Member Author

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.

@Ericson2314
Copy link
Member Author

I rebased this, and split the function to make the intent clearer.

@fricklerhandwerk fricklerhandwerk added language The Nix expression language; parser, interpreter, primops, evaluation, etc error-messages Confusing messages and better diagnostics and removed language The Nix expression language; parser, interpreter, primops, evaluation, etc labels Sep 13, 2022
@thufschmitt
Copy link
Member

@Ericson2314 do you have an example of “normal” and “malformed” EOFs? Not sure what the distinction means

@Ericson2314
Copy link
Member Author

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.

@Ericson2314 Ericson2314 marked this pull request as draft February 14, 2023 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error-messages Confusing messages and better diagnostics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants