You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have dug deeper and found that the explanation of that.
When I require your gem, it requires multi_json and makes it use its default adapter. This makes it cache JSON::ParserErrorhere. After that I require oj_mimic_json which overrides JSON::ParserErrorhere. Now when JSON.parse throws an error, MultiJSON.load fails to wrap it inside MultiJSON::ParseError and as a result you fail to rescue it here and don't even try to read the file.
I am not sure which gem is most guilty here, so I will mention this issue there too. The problem can be reproduced without your gem:
require'json'require'multi_json'MultiJson.usenilrequire'oj_mimic_json'# Throws JSON::ParserError instead of MultiJSON::ParseErrorMultiJson.load('test.json')
The text was updated successfully, but these errors were encountered:
We know that there is a problem with mulit-json. There is a PR ( #339 ) which will remove multi-json.
Can you uninstall multi-json? If multi-json is not installed, it should work. If you cannot uninstall multi-json because another project needs it, then use a custom gemset. This of course won't help if you need multi-json in the very same project.
Hello, I have noticed that this code fails with
JSON::ParserError
though it should have fallen back to reading from file:I have dug deeper and found that the explanation of that.
When I require your gem, it requires
multi_json
and makes it use its default adapter. This makes it cacheJSON::ParserError
here. After that I requireoj_mimic_json
which overridesJSON::ParserError
here. Now whenJSON.parse
throws an error,MultiJSON.load
fails to wrap it insideMultiJSON::ParseError
and as a result you fail to rescue it here and don't even try to read the file.I am not sure which gem is most guilty here, so I will mention this issue there too. The problem can be reproduced without your gem:
The text was updated successfully, but these errors were encountered: