Skip to content

handle name attribute in errors correctly#51

Open
EmileTrotignon wants to merge 2 commits intomelange-community:mainfrom
EmileTrotignon:errors-name-attr
Open

handle name attribute in errors correctly#51
EmileTrotignon wants to merge 2 commits intomelange-community:mainfrom
EmileTrotignon:errors-name-attr

Conversation

@EmileTrotignon
Copy link
Collaborator

I added better error messages previously, but they ignored the [@name "..."] attribute. Its now correctly taken into account.

I added a test case in errors.t :

  Fatal error: exception Ppx_deriving_json_runtime.Of_json_error(Json_error {|expected ["A"] or ["Foo"] or ["B", _] or ["C", _, _] or ["D", { _ }] or ["different_name"] but got ["B", 123, "booh"]|})

Before this patch this would have been :

  Fatal error: exception Ppx_deriving_json_runtime.Of_json_error(Json_error {|expected ["A"] or ["Foo"] or ["B", _] or ["C", _, _] or ["D", { _ }] or ["Different_name"] but got ["B", 123, "booh"]|})

Copy link
Member

@anmonteiro anmonteiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a small nit, otherwise looks good.

Don't forget to snapshot the tests.

Co-authored-by: Antonio Nuno Monteiro <anmonteiro@gmail.com>
@EmileTrotignon
Copy link
Collaborator Author

just a small nit, otherwise looks good.

Don't forget to snapshot the tests.

What do you mean by snapshotting the tests ?

@anmonteiro
Copy link
Member

What do you mean by snapshotting the tests ?

I mean that there's a significant diff in the cram tests, likely because of OCamlformat versions, but I think that's being taken care of in #55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants