Fix deprecation warnings on Elixir v1.15

This commit is contained in:
Adrian Kumpf
2023-06-10 17:50:37 +02:00
parent c478cc1276
commit db59717d04
5 changed files with 11 additions and 8 deletions
+4 -4
View File
@@ -92,7 +92,7 @@ defmodule TeslaApi.Stream do
end
def handle_info({:ssl, _, _} = msg, state) do
Logger.warn("Received unexpected message: #{inspect(msg)}")
Logger.warning("Received unexpected message: #{inspect(msg)}")
{:ok, state}
end
@@ -158,11 +158,11 @@ defmodule TeslaApi.Stream do
{:ok, %{"msg_type" => "data:error", "tag" => ^tag, "error_type" => "client_error"} = msg} ->
case msg do
%{"value" => "owner_api error:" <> _ = error} ->
Logger.warn("Streaming API Client Error: #{error}")
Logger.warning("Streaming API Client Error: #{error}")
{:close, state}
%{"value" => "Can't validate token" <> _} ->
Logger.warn("Streaming API: Tokens expired")
Logger.warning("Streaming API: Tokens expired")
state.receiver.(:tokens_expired)
{:ok, state}
@@ -230,7 +230,7 @@ defmodule TeslaApi.Stream do
def terminate(reason, _state) do
# https://github.com/Azolo/websockex/issues/51
with {exception, stacktrace} <- reason, true <- Exception.exception?(exception) do
with {exception, stacktrace} <- reason, true <- is_exception(exception) do
Logger.error(fn -> Exception.format(:error, exception, stacktrace) end)
else
_ -> Logger.error("Terminating: #{inspect(reason)}")
+1 -1
View File
@@ -246,7 +246,7 @@ defmodule TeslaMate.Import do
%Veh{vin: vin, vehicle_id: vid, id: eid} = v
when car != nil and nil not in [vin, vid, eid] and
vin != car.vin and vid != car.vid and eid != car.eid ->
Logger.warn(
Logger.warning(
"'#{path}' contains data for more than one vehicle: #{car.name}" <>
" -> #{v.display_name}!"
)
+1
View File
@@ -281,6 +281,7 @@ defmodule TeslaMate.Log do
query =
from d0 in subquery(drive_data),
join: d1 in subquery(non_streamed_drive_data),
on: true,
select: %{
d0
| start_ideal_range_km: d1.start_ideal_range_km,
+2 -2
View File
@@ -413,7 +413,7 @@ defmodule TeslaMate.Vehicles.Vehicle do
case stream_data do
%Stream.Data{} when stale_stream_data? ->
Logger.warn("Received stale stream data: #{inspect(stream_data)}", car_id: data.car.id)
Logger.warning("Received stale stream data: #{inspect(stream_data)}", car_id: data.car.id)
:keep_state_and_data
%Stream.Data{shift_state: shift_state} when shift_state in ~w(D N R) ->
@@ -464,7 +464,7 @@ defmodule TeslaMate.Vehicles.Vehicle do
case stream_data do
%Stream.Data{} when stale_stream_data? ->
Logger.warn("Received stale stream data: #{inspect(stream_data)}", car_id: data.car.id)
Logger.warning("Received stale stream data: #{inspect(stream_data)}", car_id: data.car.id)
:keep_state_and_data
%Stream.Data{shift_state: shift_state} when shift_state in ~w(D N R) ->
+3 -1
View File
@@ -62,7 +62,9 @@ defmodule TeslaMate.MixProject do
{:tortoise, "~> 0.10"},
{:tzdata, "~> 1.1"},
{:websockex, "~> 0.4"},
{:cloak_ecto, "~> 1.2"}
{:cloak_ecto, "~> 1.2"},
# Necessary until v1.1.7+ is released
{:ssl_verify_fun, "~> 1.1.0", manager: :rebar3, override: true}
]
end