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
Is there any reason not to inherit out_of_range exception from std::out_of_range?
The current release version v2.1.1 is throwing std::out_of_range but the latest on develop throws custom out_of_range exception which could cause backward compatibility issues.
My code below was working with v2.1.1 release version, stopped working when I moved to the latest on develop
The exception types thrown in V3 are different than in V2 and will require updates. That's why they're in a different major version.
[nlohmann::json::exception] is an extension of std::exception objects with a member @A id for exception ids. It is used as the base class for all exceptions thrown by the @ref basic_json class. This class can hence be used as "wildcard" to catch exceptions.
As @gregmarr described correctly, we wanted to have an exception base class so users can easily catch all library-related exceptions. As these changes break the API, we add them in the upcoming 3.0.0 release. I shall mention these changes in the release notes so it is clear what needs to be changed in client code.
json/src/json.hpp
Line 428 in b05ea3d
Is there any reason not to inherit
out_of_range
exception fromstd::out_of_range
?The current release version v2.1.1 is throwing std::out_of_range but the latest on develop throws custom
out_of_range
exception which could cause backward compatibility issues.My code below was working with v2.1.1 release version, stopped working when I moved to the latest on develop
The text was updated successfully, but these errors were encountered: