Make log less verbose if change message extention fails due to config error

CodeOwnersOnAddReviewer extends the change message when a code owner is
added as a reviewer. It lists the owned paths in the message. If any
relevant OWNERS file is invalid and cannot be parsed, we cannot compute
the owned files, and hence the message cannot be extended in this case.
Adding the reviewer succeeds but only the change message that is posted
for it doesn't contain any owned files. This works as intended, but we
log a verbose error (with stacktrace) in this case that is not needed.
Fix the exeption handling so that we log a warning only if the exception
is caused by a configuration error. Otherwise still log the verbose
error so that it can be investigated when it happens.

OnCodeOwnerApproval extends the change message when a code owner
approval is applied. Similarly to CodeOwnersOnAddReviewer we cannot
extend the message if relevant OWNERS files are invalid. Here too the
exception was ignored and logged with stacktrace. Catching and logging
this exception was done generically by PluginContext. Now we are
handling the exception on our own, so that also here we can log a
warning only when the exception is caused by a configuration error.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I0d1b3cf747643fd7bef512e6dce0fbd8bb940da9
5 files changed
tree: 3623cc519a0ff1ad0f258c3dcdebed37aa3a01a5
  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.