Skip to content

Commit f235177

Browse files
committed
221 - updated to_int function
1 parent d2fc685 commit f235177

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/rig_inbound_gateway/api_proxy/response_from_parser.ex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,9 @@ defmodule RigInboundGateway.ApiProxy.ResponseFromParser do
5151
# ---
5252

5353
defp to_int(value) when is_integer(value), do: value
54-
defp to_int(value) when is_binary(value), do: String.to_integer(value)
54+
defp to_int(string) when is_binary(string) do
55+
String.to_integer(string)
56+
rescue
57+
ArgumentError -> {:error, {:not_an_integer, string}}
58+
end
5559
end

0 commit comments

Comments
 (0)