[tor-bugs] #30262 [Core Tor/Stem]: stem.descriptor.remote not handling 'HTTP/1.0 404 Not found' gracefully
Tor Bug Tracker & Wiki
blackhole at torproject.org
Mon Apr 29 23:47:31 UTC 2019
#30262: stem.descriptor.remote not handling 'HTTP/1.0 404 Not found' gracefully
---------------------------+---------------------------
Reporter: starlight | Owner: atagar
Type: defect | Status: closed
Priority: Medium | Milestone:
Component: Core Tor/Stem | Version:
Severity: Normal | Resolution: not a bug
Keywords: | Actual Points:
Parent ID: | Points:
Reviewer: | Sponsor:
---------------------------+---------------------------
Changes (by atagar):
* status: needs_information => closed
* resolution: => not a bug
Comment:
Gotcha. Exceptions are not reserved for unexpected issues in python (or
most languages). When you provide an invalid input methods **should**
raise a ValueError...
{{{
>>> int('hello')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: 'hello'
}}}
When file or network issues arise you **should** receive an IOError...
{{{
>>> open('/no/such/path', 'r')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory: '/no/such/path'
}}}
... and similarly, if the descriptor you request is unavailable or cannot
be received you should receive an exception telling you that. In this
particular case Stem is being uncommonly hands-off with its exception
handling because I don't want to mask underlying network problems.
I could be talked into raising a "NoSuchDescriptor" or some other
exception type instead, but it's definitely expected that we should raise
something.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/30262#comment:6>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list