File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed
Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -384,12 +384,19 @@ defmodule ErrorTracker do
384384 occurrence
385385 end
386386
387+ @ default_json_encoder ( cond do
388+ Code . ensure_loaded? ( JSON ) -> JSON
389+ Code . ensure_loaded? ( Jason ) -> Jason
390+ true ->
391+ raise """
392+ No JSON encoder found. Please add Jason to your dependencies:
393+
394+ {:jason, "~> 1.1"}
395+
396+ Or upgrade to Elixir 1.18+.
397+ """
398+ end )
399+
387400 @ 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
401+ def __default_json_encoder__ , do: @ default_json_encoder
395402end
You can’t perform that action at this time.
0 commit comments