Improve error information when the GitLab API version can't be found.

Review Request #10336 — Created Nov. 27, 2018 and submitted

Information

Review Board
release-3.0.x
4eb5bed...

Reviewers

Users working with self-hosted GitLab installs sometimes hit errors
saying the GitLab API version could not be found. While we attempt to
store the reasons this may occur, we never actually output them
anywhere, and when authenticating against the repository we prefix with
a redundant "Unknown error" and stack trace, which doesn't help matters
too much.

This redoes this error reporting to provide a more helpful, informative
error message that lists the causes we stored (hopefully providing some
context to this error), along with some helpful hints on what may have
gone wrong (URL resolution issues or SSL certificate trust issues).
They're no longer shown as unknown errors, and the logs aren't full of
scary stack traces.

The generic error handler for the repository form has also received some
very minor tweaks, saying "Unexpected error" instead of "Uknown error"
and saying that the log file "may" have additional details. It also
removes a logging stack trace, which became redundant with the addition
of a similar logging statement in HostingServiceAuthForm.authorize
when generic SSL cert verification was introduced.

Added new unit tests, which pass.

Manually tested using some bad URLs and saw the more reasonable errors
without all the redundancy.

Description From Last Updated

Bug 4737

daviddavid

F401 'django.utils.six' imported but unused

reviewbotreviewbot

These could be combined into a single with statement.

daviddavid
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
david
  1. 
      
  2. Show all issues

    Bug 4737

  3. reviewboard/hostingsvcs/tests/test_gitlab.py (Diff revision 2)
     
     
     
     
    Show all issues

    These could be combined into a single with statement.

    1. Yeah but the resulting format is kinda ugly since you can't align the statements without upsetting linters/Review Bot. I got tired of fighting it, went with nested instead.

  4. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-3.0.x (b7fb9cf)