Skip to content

Commit

Permalink
style: make clear that string validation function can throw
Browse files Browse the repository at this point in the history
  • Loading branch information
ahamez committed Oct 7, 2024
1 parent 4d2c2ed commit 88f5fa0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/protox/decode.ex
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ defmodule Protox.Decode do
{res, rest}
end

def validate_string(bytes) do
def validate_string!(bytes) do
case Protox.String.validate(bytes) do
:ok ->
bytes
Expand Down
2 changes: 1 addition & 1 deletion lib/protox/define_decoder.ex
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ defmodule Protox.DefineDecoder do
end

defp make_parse_delimited(bytes_var, :string) do
quote(do: Protox.Decode.validate_string(unquote(bytes_var)))
quote(do: Protox.Decode.validate_string!(unquote(bytes_var)))
end

defp make_parse_delimited(bytes_var, {:enum, mod}) do
Expand Down

0 comments on commit 88f5fa0

Please sign in to comment.