Display useful errors when failing to load branches or commits.

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

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.