dynamist / phabfive

A command line tool to interact with Phabricator
Apache License 2.0
4 stars 2 forks source link

Wrap 404 errors when connecting to wrong server in better exception #31

Open Grokzen opened 4 years ago

Grokzen commented 4 years ago

Environment

Steps to Reproduce

$ PHAB_URL=http://google.se/api/ phabfive diffusion repo list
Traceback (most recent call last):
  File "/home/mai/.virtualenvs/phabfive-github/bin/phabfive", line 11, in <module>
    load_entry_point('phabfive', 'console_scripts', 'phabfive')()
  File "/home/mai/phabfive-github/phabfive/cli.py", line 176, in cli_entrypoint
    sys.exit(run(cli_args, sub_args))
  File "/home/mai/phabfive-github/phabfive/cli.py", line 139, in run
    d = diffusion.Diffusion()
  File "/home/mai/phabfive-github/phabfive/diffusion.py", line 17, in __init__
    super(Diffusion, self).__init__()
  File "/home/mai/phabfive-github/phabfive/core.py", line 77, in __init__
    self.verify_connection()
  File "/home/mai/phabfive-github/phabfive/core.py", line 83, in verify_connection
    result = self.phab.user.whoami()
  File "/home/mai/.virtualenvs/phabfive-github/local/lib/python2.7/site-packages/phabricator/__init__.py", line 248, in __call__
    return self._request(**kwargs)
  File "/home/mai/.virtualenvs/phabfive-github/local/lib/python2.7/site-packages/phabricator/__init__.py", line 314, in _request
    'Bad response status: {0}'.format(response.status)
httplib.HTTPException: Bad response status: 404

Expected Behavior

Better wrapped exception

Observed Behavior

Bad wrapped exception