Add the culprit json fragment in the error messages systematically.#47
Merged
Merged
Conversation
anmonteiro
approved these changes
Dec 20, 2024
Member
anmonteiro
left a comment
There was a problem hiding this comment.
this looks pretty great, nice work!
andreypopp
requested changes
Dec 20, 2024
Collaborator
andreypopp
left a comment
There was a problem hiding this comment.
This is a very good improvement!
Left some comments below.
Collaborator
Author
|
I thought it was a bit confusing to have all the runtime files mixed with the ppx files, especially because I added a bunch, so I moved them to a separate folder. If there is no issue with that, I have addressed every comment I got, I think its time to merge (I do not have the rights to do it). |
jchavarri
reviewed
Feb 24, 2025
| [%expr | ||
| if Stdlib.( <> ) [%e len] [%e eint ~loc n] then | ||
| Ppx_deriving_json_runtime.of_json_error | ||
| Ppx_deriving_json_runtime.of_json_msg_error ~json:[%e x] |
Member
There was a problem hiding this comment.
@EmileTrotignon This function doesn't take a json arg but somehow the tests passed. 🤔
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The culprit fragment is the piece of json that is wrong. It is printed with a special shallow printer, in order to keep the messages short and to the point.
I have included new tests.
A bit of code smell is the fact that my code relies on the fact that the current json being converted is always called
x. Help is appreciated on that front, in a lot of cases I could not get the proper expression.I will probably add a bit more tests tomorrow.