#3513 closed defect (fixed)

no_network should use `Failure.raiseException` instead of `raise failure.value`

Reported by: exarkun Owned by: GitHub <noreply@…>
Priority: normal Milestone: undecided
Component: unknown Version: n/a
Keywords: review Cc:
Launchpad Bug:

Description

NoNetworkGrid._check_clients looks at some Failures that it may have recorded and then raises an exception if there are any.

It raises the exception like this:

raise self._setup_errors[0].value

This throws away the traceback that has been preserved in the Failure and means there is no meaningful context for the exception that is reported.

Instead it should

self._setup_errors[0].raiseException()

This is the difference between:

Traceback (most recent call last):
  File "/home/exarkun/VirtualEnvs/tahoe-lafs/lib/python2.7/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks                                                          
    result = g.send(result)
  File "/home/exarkun/Work/python/tahoe-lafs/src/allmydata/test/cli/test_alias.py", line 20, in test_list                                                                                    
    self.set_up_grid(oneshare=True)
  File "/home/exarkun/Work/python/tahoe-lafs/src/allmydata/test/no_network.py", line 495, in set_up_grid                                                                                     
    c = self.get_client(0)
  File "/home/exarkun/Work/python/tahoe-lafs/src/allmydata/test/no_network.py", line 518, in get_client                                                                                      
    self.g._check_clients()
  File "/home/exarkun/Work/python/tahoe-lafs/src/allmydata/test/no_network.py", line 360, in _check_clients                                                                                  
    raise self._setup_errors[0].value
exceptions.TypeError: buildServer() takes exactly 5 arguments (4 given)

and

Traceback (most recent call last):
  File "/home/exarkun/Work/python/tahoe-lafs/src/allmydata/test/cli/test_alias.py", line 20, in test_list                                                                                    
    self.set_up_grid(oneshare=True)
  File "/home/exarkun/Work/python/tahoe-lafs/src/allmydata/test/no_network.py", line 495, in set_up_grid                                                                                     
    c = self.get_client(0)
  File "/home/exarkun/Work/python/tahoe-lafs/src/allmydata/test/no_network.py", line 518, in get_client                                                                                      
    self.g._check_clients()
  File "/home/exarkun/Work/python/tahoe-lafs/src/allmydata/test/no_network.py", line 360, in _check_clients                                                                                  
    self._setup_errors[0].raiseException()
  File "<string>", line 2, in raiseException

  File "/home/exarkun/VirtualEnvs/tahoe-lafs/lib/python2.7/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks                                                          
    result = g.send(result)
  File "/home/exarkun/Work/python/tahoe-lafs/src/allmydata/test/no_network.py", line 389, in make_client                                                                                     
    c = yield create_no_network_client(clientdir)
  File "/home/exarkun/Work/python/tahoe-lafs/src/allmydata/test/no_network.py", line 253, in create_no_network_client                                                                        
    storage_farm_broker=storage_broker,
  File "/home/exarkun/Work/python/tahoe-lafs/src/allmydata/client.py", line 717, in __init__
    self.init_web(webport) # strports string
  File "/home/exarkun/Work/python/tahoe-lafs/src/allmydata/client.py", line 1068, in init_web
    staticdir,
  File "/home/exarkun/Work/python/tahoe-lafs/src/allmydata/webish.py", line 179, in __init__
    self.buildServer(webport, nodeurl_path, staticdir)
exceptions.TypeError: buildServer() takes exactly 5 arguments (4 given)

The latter correctly points at webish.py:179 whereas the form just points at unrelated test infrastructure code.

Change History (2)

comment:2 Changed at 2020-11-25T15:41:20Z by GitHub <noreply@…>

  • Owner set to GitHub <noreply@…>
  • Resolution set to fixed
  • Status changed from new to closed

In bd9a91a/trunk:

Merge pull request #901 from tahoe-lafs/3513.raiseException

Fix exception re-raising in no_network.py

Fixes: ticket:3513

Note: See TracTickets for help on using tickets.