[tahoe-lafs-trac-stream] [Tahoe-LAFS] #3513: no_network should use `Failure.raiseException` instead of `raise failure.value`

Tahoe-LAFS trac at tahoe-lafs.org
Wed Nov 18 19:47:53 UTC 2020


#3513: no_network should use `Failure.raiseException` instead of `raise
failure.value`
---------------------+---------------------------
 Reporter:  exarkun  |          Owner:
     Type:  defect   |         Status:  new
 Priority:  normal   |      Milestone:  undecided
Component:  unknown  |        Version:  n/a
 Keywords:           |  Launchpad Bug:
---------------------+---------------------------
 `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.

--
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3513>
Tahoe-LAFS <https://Tahoe-LAFS.org>
secure decentralized storage


More information about the tahoe-lafs-trac-stream mailing list