Do not throw code owners ISE if cause is DiffNotAvailableException

For internal server errors that occur in the code-owners plugin we throw
a specific RuntimeException (CodeOwnersInternalServerErrorException). If
this exception is thrown we let the user know that there was an internal
server error in the code-owners plugin, instead of just saying that
there was an internal server error. This was done to root cause
exceptions that were caused by the code-owners plugin more quickly to
the code-owners plugin. However not all exceptions that happen in the
code-owners plugin are caused by the code-owners plugin. E.g. if the
code-owners plugin invokes functionality in Gerrit core and a failure
happens there then the exception is caused by Gerrit core and not the
code-owners plugin. So far these false positives were not a big issue
since by looking at the cause detecting them was easy. However lately
there are often failures caused by corrupted data in Git that cause
DiffNotAvailableException's in Gerrit core when trying to get the file
diff for a commit. This is functionality that the code-owners plugin
invokes frequently and hence the code-owners plugin is often affected by
this. In these cases users and also developers investigating the issue
blame the code-owners plugin for the error. This is bad since it delays
investigating the actual root cause. So for this particular case we stop
throwing CodeOwnersInternalServerErrorException, but instead throw
StorageException, so that this becomes a regular Gerrit internal server
error, which is what it is. This doesn't change the stacktrace of the
exception, but only the exception type. So from the stacktrace you can
still see that the error affected the code-owners plugin.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: Ie191c7f0137656199b8fa5d19ab49e9bd0344a6f
15 files changed
tree: e027051f91c3cc4215f413dbd88391ad65d9dd94
  1. java/
  2. javatests/
  3. proto/
  4. resources/
  5. test/
  6. ui/
  7. .eslintrc.json
  8. .gitignore
  9. .gitreview
  10. bower.json
  11. BUILD
  12. LICENSE
  13. package-lock.json
  14. package.json
  15. README.md
README.md

Gerrit Code Review code-owners plugin

This plugin provides support for defining code owners for files in a repository.

If the code-owners plugin is enabled, changes can only be submitted if all touched files are covered by approvals from code owners.

Also see resources/Documentation/about.md.

IMPORTANT: Before installing/enabling the plugin follow the instructions from the setup guide, see resources/Documentation/setup-guide.md.

JavaScript Plugin

For testing the plugin with Gerrit FE Dev Helper build the JavaScript bundle and copy it to the plugins/ folder:

bazel build //plugins/code-owners/ui:code-owners
cp -f bazel-bin/plugins/code-owners/ui/code-owners.js plugins/

and let the Dev Helper redirect from .+/plugins/code-owners/static/code-owners.js to http://localhost:8081/plugins_/code-owners.js.