Skip to content

Commit

Permalink
fix: add an error for get_payload() (#297)
Browse files Browse the repository at this point in the history
  • Loading branch information
abc3 authored Feb 2, 2024
1 parent f3aa905 commit ac02bde
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.30
1.1.31
4 changes: 3 additions & 1 deletion lib/supavisor/protocol/client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ defmodule Supavisor.Protocol.Client do

def decode_pkt(_), do: {:error, :header_mismatch}

@spec get_payload(binary) :: {:ok, String.t()} | {:error, any}
@spec get_payload(binary | any()) :: {:ok, String.t()} | {:error, any}
def get_payload(<<char::8, pkt_len::32, rest::binary>>) do
case tag(char) do
nil ->
Expand All @@ -84,6 +84,8 @@ defmodule Supavisor.Protocol.Client do
end
end

def get_payload(msg), do: {:error, {:invalid_msg, msg}}

@spec tag(byte) :: atom | nil
def tag(char) do
case char do
Expand Down

0 comments on commit ac02bde

Please sign in to comment.