-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Improve wording of parse_error exception #4037 #4073
Conversation
@@ -479,6 +479,10 @@ class parser | |||
error_msg += concat(m_lexer.get_error_message(), "; last read: '", | |||
m_lexer.get_token_string(), '\''); | |||
} | |||
else if (last_token == token_type::end_of_input && m_lexer.get_position().chars_read_total == 1) | |||
{ | |||
error_msg += concat("unexpected end of input, check that your input string or stream contains the expected JSON"); |
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.
That error message confuses me.
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.
What would you suggest, I change it to?
Also about the amalgamation checks, I run check_amalgamate on my local machine and it passes. I think it's because of astyle version difference which version should I use?
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.
Hi again, I'm free for a few more days, my semester starts after that, it'd be great if you could reply in the next 2-3 days, however, I'm still happy to contribute after that.
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.
I'm on vacation, so I cannot really help here.
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.
I would recommend something along the lines of "the provided input was empty, check that you are providing the expected input", so it's not just "unexpected end of input" but "the input was empty".
🔴 Amalgamation check failed! 🔴The source code has not been amalgamated. @CosmicPegasis |
This pull request improves the error message for the end of input parse_error.
Pull request checklist
Read the Contribution Guidelines for detailed information.
include/nlohmann
directory, runmake amalgamate
to create the single-header filessingle_include/nlohmann/json.hpp
andsingle_include/nlohmann/json_fwd.hpp
. The whole process is described here.Please don't
#ifdef
s or other means.