-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Better diagnostics #2562
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
Merged
Merged
Better diagnostics #2562
Changes from 37 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
a4d491e
:construction: better diagnostics
nlohmann 7b04786
:construction: add diagnostics to exceptions
nlohmann ecaab32
:construction: add switch for diagnostics
nlohmann c6e7fa2
:construction: fix preprocessor check
nlohmann 09cd4ed
:construction: fix preprocessor check
nlohmann 7323a8e
:construction: add tests
nlohmann ec0b179
:construction: implement more parent relations
nlohmann 294fa34
:bug: fix bug in move constructor
nlohmann 7cdf34b
Merge branch 'develop' of https://github.com/nlohmann/json into diagn…
nlohmann ddc3bb1
:ok_hand: remove unnecessary assignment from destructor
nlohmann 0617bd2
:ok_hand: fix operator[]
nlohmann 04a0a07
:ok_hand: fix move constructor and move assignment
nlohmann e4af1dd
:ok_hand: fix operator[]
nlohmann d4a91b7
:ok_hand: clean operator[]
nlohmann 43cd5c8
:ok_hand: fix constructor
nlohmann e160749
:recycle: move diagnostic code in header
nlohmann a834045
:rotating_light: fix warnings
nlohmann 1d6ba22
:recycle: simplify code
nlohmann 9d0150c
:recycle: simplify code
nlohmann ff57bdc
:bug: fix invariants
nlohmann 10751d1
Merge branch 'develop' of https://github.com/nlohmann/json into diagn…
nlohmann b9d3aa4
:recycle: split set_parent function
nlohmann a776216
:memo: fix comment
nlohmann 0d1fb38
:ok_hand: address comment
nlohmann f803766
:recycle: add iterator set_parent function
nlohmann 1a467a8
Merge branch 'develop' of https://github.com/nlohmann/json into diagn…
nlohmann b0d8628
:ok_hand: address comments
nlohmann 7633a21
:green_heart: fix build
nlohmann e9d6411
:bug: proper JSON Pointer escape in diagnostic messages
nlohmann aeecc09
:white_check_mark: add tests for diagnostics
nlohmann e23af74
:rotating_light: fix warnings
nlohmann 65107f7
:green_heart: fix build
nlohmann 5ec0980
:green_heart: fix build
nlohmann 3337968
:white_check_mark: improve coverage
nlohmann d6ff059
:ok_hand: addressed review comments
nlohmann 51ac600
:white_check_mark: improve coverage
nlohmann d00ad33
:memo: update documentation
nlohmann 7b7da08
:memo: update documentation
nlohmann 380a613
:bug: fix bug in diagnostics_t
nlohmann c190a72
:ok_hand: apply suggestion
nlohmann e8dba10
:white_check_mark: add test
nlohmann 74cc0ab
:recycle: remove diagnostics_t class
nlohmann 524eea5
:ok_hand: remove unused template parameter
nlohmann 4917e7c
Merge branch 'develop' of https://github.com/nlohmann/json into diagn…
nlohmann 56a6dec
:twisted_rightwards_arrows: merge develop branch
nlohmann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #include <iostream> | ||
|
|
||
| # define JSON_DIAGNOSTICS 1 | ||
| #include <nlohmann/json.hpp> | ||
|
|
||
| using json = nlohmann::json; | ||
|
|
||
| int main() | ||
| { | ||
| json j; | ||
| j["address"]["street"] = "Fake Street"; | ||
| j["address"]["housenumber"] = "12"; | ||
|
|
||
| try | ||
| { | ||
| int housenumber = j["address"]["housenumber"]; | ||
| } | ||
| catch (json::exception& e) | ||
| { | ||
| std::cout << e.what() << '\n'; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| <a target="_blank" href="https://wandbox.org/permlink/pbz3ULoJ4maRnV8N"><b>online</b></a> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| [json.exception.type_error.302] (/address/housenumber) type must be number, but is string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #include <iostream> | ||
| #include <nlohmann/json.hpp> | ||
|
|
||
| using json = nlohmann::json; | ||
|
|
||
| int main() | ||
| { | ||
| json j; | ||
| j["address"]["street"] = "Fake Street"; | ||
| j["address"]["housenumber"] = "12"; | ||
|
|
||
| try | ||
| { | ||
| int housenumber = j["address"]["housenumber"]; | ||
| } | ||
| catch (json::exception& e) | ||
| { | ||
| std::cout << e.what() << '\n'; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| <a target="_blank" href="https://wandbox.org/permlink/fWfQhHzG03P6PAcC"><b>online</b></a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| [json.exception.type_error.302] type must be number, but is string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.