Skip to content

Commit

Permalink
Don't rescue on decode, just use non bang decode
Browse files Browse the repository at this point in the history
  • Loading branch information
warmwaffles committed Jan 9, 2025
1 parent 29519bb commit bbe7ebe
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/ecto/adapters/sqlite3/codec.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ defmodule Ecto.Adapters.SQLite3.Codec do
def bool_decode(v), do: {:ok, v}

def json_decode(v) when is_binary(v) do
{:ok, Application.get_env(:ecto_sqlite3, :json_library, Jason).decode!(v)}
rescue
_ -> :error
case Application.get_env(:ecto_sqlite3, :json_library, Jason).decode(v) do
{:ok, decoded} -> {:ok, decoded}
{:error, _reason} -> :error
end
end

def json_decode(v), do: {:ok, v}
Expand Down

0 comments on commit bbe7ebe

Please sign in to comment.