You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
The function spec of uri_string:percent_decode/1 is not complete when it comes to the return values.
It is possible to get a return value of format {error, atom(), term()} as spec:ed by uri_string:raw_decode/1, which is called directly when a binary() or list() is passed as value to uri_string:percent_decode/1.
When handling this possible output Dialyzer will complain about not being able to match the output.
Expected behavior
I would expect that the potential return value {error, atom(), term()} is handled in some way, be it that percent_decode handles it and return a uniform error structure or that a secondary error structure is returned and the spec reflecting that, such that dialyzer stops complaining.
It can also be worth mentioning that same percent_decode may also throw an error if the input is binary.
For instance:
1> uri_string:percent_decode(<<"foo%f2bar">>).
** exception throw: {error,invalid_utf8,<<"fooòbar">>}
in function uri_string:check_utf8/1 (uri_string.erl, line 1575)
Affected versions
Erlang/OTP 26 [erts-14.2.5]
Running this version and have only checked on this version.
The text was updated successfully, but these errors were encountered:
Description
The function spec of
uri_string:percent_decode/1
is not complete when it comes to the return values.It is possible to get a return value of format
{error, atom(), term()}
as spec:ed byuri_string:raw_decode/1
, which is called directly when abinary()
orlist()
is passed as value touri_string:percent_decode/1
.When handling this possible output
Dialyzer
will complain about not being able to match the output.To Reproduce
In an erlang shell:
When running
dialyzer
on module:Expected behavior
I would expect that the potential return value
{error, atom(), term()}
is handled in some way, be it thatpercent_decode
handles it and return a uniform error structure or that a secondary error structure is returned and the spec reflecting that, such that dialyzer stops complaining.It can also be worth mentioning that same
percent_decode
may also throw an error if the input is binary.For instance:
Affected versions
Erlang/OTP 26 [erts-14.2.5]
Running this version and have only checked on this version.
The text was updated successfully, but these errors were encountered: