-
-
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
JSON Parse Out of Range Error #1574
Comments
Can you please post the description of the exception ( |
I get: from this function bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/,
const detail::exception& ex)
{
errored = true;
if (allow_exceptions)
{
// determine the proper exception type from the id
switch ((ex.id / 100) % 100)
{
case 1:
JSON_THROW(*static_cast<const detail::parse_error*>(&ex));
case 4:
JSON_THROW(*static_cast<const detail::out_of_range*>(&ex)); //Exception is thrown here!
// LCOV_EXCL_START
case 2:
JSON_THROW(*static_cast<const detail::invalid_iterator*>(&ex));
case 3:
JSON_THROW(*static_cast<const detail::type_error*>(&ex));
case 5:
JSON_THROW(*static_cast<const detail::other_error*>(&ex));
default:
assert(false);
// LCOV_EXCL_STOP
}
}
return false;
} |
Can you catch the exception and print |
How do i do that? I tried catching the exception but it still crashed rather than printing anything |
Like this: try
{
// put here whatever code you call where the exception is triggered
}
catch (std::exception& e)
{
std::cerr << e.what() << std::endl;
} |
This is not the library's fault - please check if the input you parse is proper JSON. |
Oh, I was also on the wrong issue, sorry. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Hi all,
I am getting an out of range error when I'm trying to parse my json file and I'm not sure why.
My json file
The text was updated successfully, but these errors were encountered: