michalmuskala/jason

Better error message on invalid `@derive Jason.Encoder` options

Open

#183 opened on Feb 10, 2024

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Elixir (1,676 stars) (177 forks)batch import
enhancementhelp wanted

Description

Current behavior

When passing an invalid option, eg:

@derive {Jason.Encoder, invalid: [:__meta__]}

It returns the following error: cannot encode metadata from the :__meta__ field for CrosswordsApi.Users.User to JSON.

Expected behavior

Could the error be explicit that expect or only should be passed as valid options only?

Contributor guide