HTTP redirect throws Error
, should throw Exception
#53158
Labels
area-vm
Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
library-io
P2
A bug or feature request we're likely to work on
triaged
Issue has been triaged by sub team
On this line of
http_impl.dart
, aStateError
is thrown if the response is a redirect and noLocation
header was present in the response:According to the documentation for the
Error
class (of whichStateError
is a subclass):However, the presence -- or lack thereof -- of a specific header in a response from a remote server is not something that I, as the Dart programmer, could have avoided. Nor does it mean the "program is erroneous."
It is thus my opinion that this situation should throw an object which is a descendent of
Exception
(perhaps, for example, aRedirectException
such as appears just a few lines further inhttp_impl.dart
), and not a descendent ofError
.It makes little sense to use
on StateError
to catch this run-time issue.See also:
Community note: Please tap the "thumbs-up" on this issue if it is affecting you and you'd like it to be prioritized.
The text was updated successfully, but these errors were encountered: