File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed
Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -384,12 +384,23 @@ defmodule ErrorTracker do
384384 occurrence
385385 end
386386
387+ @ default_json_encoder ( cond do
388+ Code . ensure_loaded? ( JSON ) ->
389+ JSON
390+
391+ Code . ensure_loaded? ( Jason ) ->
392+ Jason
393+
394+ true ->
395+ raise """
396+ No JSON encoder found. Please add Jason to your dependencies:
397+
398+ {:jason, "~> 1.1"}
399+
400+ Or upgrade to Elixir 1.18+.
401+ """
402+ end )
403+
387404 @ doc false
388- def __default_json_encoder__ do
389- # Elixir 1.18+ includes the JSON module. On older versions we should fall back to Jason (which
390- # is listed as an optional dependency).
391- if Version . match? ( System . version ( ) , ">= 1.18.0" ) ,
392- do: JSON ,
393- else: Jason
394- end
405+ def __default_json_encoder__ , do: @ default_json_encoder
395406end
You can’t perform that action at this time.
0 commit comments