ditto icon indicating copy to clipboard operation
ditto copied to clipboard

Confusing error message in case of Http requests `timeout` parameter out of range

Open abalarev opened this issue 2 years ago • 4 comments

When using http request with parameter timeout, currently the parameter units are seconds in range 0-60. If a value passed is out of range (for example timeout=90), the response error message says The timeout <90 000ms> is not inside its allowed bounds <0ms - 60 000ms>, which is incorrect. The message should give the range and the units in seconds (instead of in milliseconds)

abalarev avatar Apr 11 '22 07:04 abalarev

What is incorrect here? When the unit is omitted from the timeout parameter, it is treated as s (seconds) - so 90 000ms is the correct interpretation into ms. You could also specify e.g. a timeout=1337ms instead.

For simplicity, the exception always uses ms as unit for its description text.

thjaeckle avatar Apr 11 '22 07:04 thjaeckle

Actually the values are correct, maybe it's a bit confusing to specify seconds by default and receive a response message in milliseconds instead. I didn't know ms could be specified explicitly. I could close the issue if this behaviour is the desired one.

abalarev avatar Apr 11 '22 08:04 abalarev

Yes, it is not "incorrect" - it could be more convenient to get the unit in the exception text which was passed in. If you want to contribute that improvement, we are open to accept a PR improving that 😃

thjaeckle avatar Apr 11 '22 08:04 thjaeckle

I would like to do that as my first contribution, so I'll keep the issue open.

abalarev avatar Apr 11 '22 08:04 abalarev