More descriptive parse_number errors #297
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The parse_number structs throw errors through do_from_chars and do_strtod whenever a user enters a numerical argument error, but the errors are extremely undescriptive and give little to no detail on what type or notation was expected.
In order to give more descriptive errors for when parsing numbers fail for this reason, I added try/catch wrappers around the do_from_chars and do_strtod calls in the implemented parse_number templates. Now, the thrown errors will also have a message which displays what type of number the parsed number was expected to be, while maintaining the messages and error types from do_from_chars and do_strtod in the process.