uri_string weird inconsistency

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

uri_string weird inconsistency

Loïc Hoguin-3
Hello,

Why does uri_string:normalize/1 catch a throw and return an error tuple,
but uri_string:normalize/2 does not? Both are documented functions and
this behavior difference is not documented, besides the 2-arity not
having error() as a returned type:
http://erlang.org/doc/man/uri_string.html#normalize-1

Is this an oversight perhaps?

Cheers,

--
Loïc Hoguin
https://ninenines.eu
Reply | Threaded
Open this post in threaded view
|

RE: uri_string weird inconsistency

Peter Dimitrov

Hi,


This is a bug in the type spec and as far as I see the catch is unnecessary in uri_string:normalize/1 as exceptions are already caught in all other functions that are called by normalize.

The intended behavior is to always return an error tuple in case of an error.


BR/Peter


-----Original Message-----
From: erlang-questions <
[hidden email]> On Behalf Of Loïc Hoguin
Sent: den 23 november 2019 17:21
To: Erlang Questions <[hidden email]>
Subject: uri_string weird inconsistency

 

Hello,

 

Why does uri_string:normalize/1 catch a throw and return an error tuple, but uri_string:normalize/2 does not? Both are documented functions and this behavior difference is not documented, besides the 2-arity not having error() as a returned type:

https://protect2.fireeye.com/v1/url?k=8b83a40f-d70986e6-8b83e494-0cc47ad93e2e-315c3a8c3f88d867&q=1&e=db14f46e-9908-4d65-828f-a5804e01ef18&u=http%3A%2F%2Ferlang.org%2Fdoc%2Fman%2Furi_string.html%23normalize-1

 

Is this an oversight perhaps?

 

Cheers,

 

--

Loïc Hoguin

https://protect2.fireeye.com/v1/url?k=3f9e31b6-6314135f-3f9e712d-0cc47ad93e2e-d1a6f2e3a8affc9e&q=1&e=db14f46e-9908-4d65-828f-a5804e01ef18&u=https%3A%2F%2Fninenines.eu%2F