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
{{ message }}
Repository navigation
Proposal: out_of_range should be a subclass of std::out_of_range #756
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.
Activity
gregmarr commentedon Sep 27, 2017
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 commentedon Sep 29, 2017
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.
nlohmann commentedon Oct 27, 2017
Closing this. Exceptions will be documented in 3.0.0.