Dialyzer: no_local_return

WebPushEncryption.send_web_push/4 was written to raise on erroroneus input, so we must guard against that.

lib/pleroma/web/push/impl.ex:65:no_return Function push_message/4 has no local return.
This commit is contained in:
Mark Felder 2024-05-28 09:58:44 -04:00
parent 17ebb2df84
commit 1b3c84e241
1 changed files with 16 additions and 10 deletions

View File

@ -63,6 +63,7 @@ def perform(_) do
@doc "Push message to web" @doc "Push message to web"
def push_message(body, sub, api_key, subscription) do def push_message(body, sub, api_key, subscription) do
try do
case WebPushEncryption.send_web_push(body, sub, api_key) do case WebPushEncryption.send_web_push(body, sub, api_key) do
{:ok, %{status: code}} when code in 400..499 -> {:ok, %{status: code}} when code in 400..499 ->
Logger.debug("Removing subscription record") Logger.debug("Removing subscription record")
@ -76,6 +77,11 @@ def push_message(body, sub, api_key, subscription) do
Logger.error("Web Push Notification failed with code: #{code}") Logger.error("Web Push Notification failed with code: #{code}")
:error :error
error ->
Logger.error("Web Push Notification failed with #{inspect(error)}")
:error
end
rescue
error -> error ->
Logger.error("Web Push Notification failed with #{inspect(error)}") Logger.error("Web Push Notification failed with #{inspect(error)}")
:error :error