mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-22 16:16:34 +00:00
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:
parent
17ebb2df84
commit
1b3c84e241
1 changed files with 16 additions and 10 deletions
|
@ -63,19 +63,25 @@ defmodule Pleroma.Web.Push.Impl 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
|
||||||
case WebPushEncryption.send_web_push(body, sub, api_key) do
|
try do
|
||||||
{:ok, %{status: code}} when code in 400..499 ->
|
case WebPushEncryption.send_web_push(body, sub, api_key) do
|
||||||
Logger.debug("Removing subscription record")
|
{:ok, %{status: code}} when code in 400..499 ->
|
||||||
Repo.delete!(subscription)
|
Logger.debug("Removing subscription record")
|
||||||
:ok
|
Repo.delete!(subscription)
|
||||||
|
:ok
|
||||||
|
|
||||||
{:ok, %{status: code}} when code in 200..299 ->
|
{:ok, %{status: code}} when code in 200..299 ->
|
||||||
:ok
|
:ok
|
||||||
|
|
||||||
{:ok, %{status: code}} ->
|
{:ok, %{status: code}} ->
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue