• 
      

    Display useful errors when failing to load branches or commits.

    Review Request #6267 — Created Aug. 25, 2014 and submitted

    Information

    Review Board
    release-2.0.x
    29ba7af...

    Reviewers

    In the New Review Request page, if there's any sort of issue loading the
    list of branches or commits from a repository, the result is a blank
    list of branches or commits with no error message, and an error e-mail
    sent to administrators. This is not very helpful.

    Now when there's an error loading any data from the server, an error
    box will appear saying there was an issue loading from the server,
    and showing the server-provided error message. The user will be given
    the option to try the request again.

    For this to work, RepositoryBranchesCollection had to be made a subclass
    of BaseCollection, and BaseCollection had to be given support for
    parsing and storing errors on the xhr, similar to what BaseResource
    does. This code has been pulled out into a common function that both
    classes now use.

    The RepositoryBranches and RepositoryCommits resources now return a
    proper error code when encountering a SCMError. We're reusing the "Error
    fetching information from this repository" error, with a custom message
    (provided by the SCMError).

    Tested without any errors from the repository.

    Simulated branch failure. Clicked a repository and saw an error message,
    with the branch selector gone. I then clicked "Try Again," and got the
    same result. Then I turned off the simulated error, tried again, and got
    the full branches and commits list.

    Simulated commits failure. Clicked a repository and saw the branches, and
    an error message. I then clicked "Try Again," and got the same result. Then
    I turned off the simulated error, tried again, and got the full commits list.

    Unit tests pass.


    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          reviewboard/webapi/resources/repository_commits.py
          reviewboard/webapi/resources/repository_branches.py
      
      Ignored Files:
          reviewboard/static/rb/js/resources/collections/repositoryBranchesCollection.js
          reviewboard/static/rb/css/newReviewRequest.less
          reviewboard/static/rb/js/collections/baseCollection.js
          reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js
          reviewboard/static/rb/js/utils/apiUtils.js
          reviewboard/static/rb/js/resources/models/baseResourceModel.js
          reviewboard/static/rb/js/newReviewRequest/views/tests/postCommitViewTests.js
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/webapi/resources/repository_commits.py
          reviewboard/webapi/resources/repository_branches.py
      
      Ignored Files:
          reviewboard/static/rb/js/resources/collections/repositoryBranchesCollection.js
          reviewboard/static/rb/css/newReviewRequest.less
          reviewboard/static/rb/js/collections/baseCollection.js
          reviewboard/static/rb/js/newReviewRequest/views/postCommitView.js
          reviewboard/static/rb/js/utils/apiUtils.js
          reviewboard/static/rb/js/resources/models/baseResourceModel.js
          reviewboard/static/rb/js/newReviewRequest/views/tests/postCommitViewTests.js
      
      
    2. 
        
    david
    1. Ship It!

    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-2.0.x (6e9a878)