Some DatabaseQuery.call failure pattern matching never match. The function always returns {:error, _} when it fails.
Expected Behavior
with {:ok, _result} <- DatabaseQuery.call(client, batch) do
:ok
else
{:error, reason} ->
error_message =
case reason do
%{acc: _, msg: error_msg} -> error_msg
_ -> inspect(reason)
end
Logger.warning("Failed batch due to database error: #{error_message}.", tag: "db_error")
{:error, :database_error}
end
Description
Some
DatabaseQuery.call
failure pattern matching never match. The function always returns{:error, _}
when it fails.Expected Behavior
Current Behavior
see here: https://github.com/astarte-platform/astarte/blob/c335319e11dc0c0d8b0b28e8a36b26af33f5fc60/apps/astarte_realm_management/lib/astarte_realm_management/queries.ex#L168 https://github.com/astarte-platform/astarte/blob/c335319e11dc0c0d8b0b28e8a36b26af33f5fc60/apps/astarte_realm_management/lib/astarte_realm_management/queries.ex#L194