From 88f5fa013e5e47a2f8d202a19addc26797de026f Mon Sep 17 00:00:00 2001 From: Alexandre Hamez Date: Mon, 7 Oct 2024 18:21:53 +0200 Subject: [PATCH] style: make clear that string validation function can throw --- lib/protox/decode.ex | 2 +- lib/protox/define_decoder.ex | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/protox/decode.ex b/lib/protox/decode.ex index 5fdc14d8..ba2d80ba 100644 --- a/lib/protox/decode.ex +++ b/lib/protox/decode.ex @@ -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 diff --git a/lib/protox/define_decoder.ex b/lib/protox/define_decoder.ex index 81ce68c7..f6429c65 100644 --- a/lib/protox/define_decoder.ex +++ b/lib/protox/define_decoder.ex @@ -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