juju / theblues

Python library for the juju charmstore (v4)
GNU Lesser General Public License v3.0
5 stars 22 forks source link

AttributeError: 'ConnectionError' object has no attribute 'message' #54

Open johnsca opened 7 years ago

johnsca commented 7 years ago

The original failure that caused this was a DNS resolution failure, but in attempting to turn that into a ServerError, theblues failed with this. Using something like str(exc) would be safest, but you could also do something with getattr(). I think some exception types use msg rather than message, as well.

AttributeError: 'ConnectionError' object has no attribute 'message'
  File "conjureup/controllers/deploy/tui.py", line 34, in do_deploy
    await asyncio.gather(*tasks)
  File "conjureup/juju.py", line 622, in deploy_service
    app_inst = await app.juju.client.deploy(**deploy_args)
  File "juju/model.py", line 1081, in deploy
    entity = await self.charmstore.entity(entity_url, channel=channel)
  File "juju/model.py", line 1926, in coro
    return await self.loop.run_in_executor(None, method)
  File "concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "theblues/charmstore.py", line 136, in entity
    return self._meta(entity_id, includes, channel=channel)
  File "theblues/charmstore.py", line 107, in _meta
    data = self._get(url)
  File "theblues/charmstore.py", line 83, in _get
    message=exc.message)
johnsca commented 7 years ago

Got this for a ProxyError type as well:

AttributeError: 'ProxyError' object has no attribute 'message'
  File "conjureup/controllers/deploy/gui.py", line 245, in _do_deploy
    await juju.deploy_service(application, default_series, msg_cb=msg_cb)
  File "conjureup/juju.py", line 622, in deploy_service
    app_inst = await app.juju.client.deploy(**deploy_args)
  File "juju/model.py", line 1081, in deploy
    entity = await self.charmstore.entity(entity_url, channel=channel)
  File "juju/model.py", line 1926, in coro
    return await self.loop.run_in_executor(None, method)
  File "concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "theblues/charmstore.py", line 136, in entity
    return self._meta(entity_id, includes, channel=channel)
  File "theblues/charmstore.py", line 107, in _meta
    data = self._get(url)
  File "theblues/charmstore.py", line 83, in _get
    message=exc.message)