Skip to content

Commit a54d96f

Browse files
authored
Improve exception message for Jason.Encoder errors (#4534)
1 parent 4f0c990 commit a54d96f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/ecto/json.ex

+7-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ if Code.ensure_loaded?(Jason.Encoder) do
1717
1818
@derive {Jason.Encoder, only: [:name, :title, ...]}
1919
schema ... do
20+
21+
You can also use the :except option instead of :only if you would \
22+
prefer to skip some fields.
2023
"""
2124
end
2225
end
@@ -29,13 +32,16 @@ if Code.ensure_loaded?(Jason.Encoder) do
2932
exposed externally.
3033
3134
You can either map the schemas to remove the :__meta__ field before \
32-
encoding to JSON, or explicitly list the JSON fields in your schema:
35+
encoding or explicitly list the JSON fields in your schema:
3336
3437
defmodule #{inspect(schema)} do
3538
# ...
3639
3740
@derive {Jason.Encoder, only: [:name, :title, ...]}
3841
schema ... do
42+
43+
You can also use the :except option instead of :only if you would \
44+
prefer to skip some fields.
3945
"""
4046
end
4147
end

0 commit comments

Comments
 (0)