Debug of ALL exception during pull request import
When importing Pull Requests, the Throwable errors
were not traced: we need to detect and log all of
them because they may happen in background threads
and need to be reported back to the user.
Change-Id: I092ee575429d954efebe76d0fcfac577a388a3a6
diff --git a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/PullRequestImportJob.java b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/PullRequestImportJob.java
index 0e941af..9e007f8 100644
--- a/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/PullRequestImportJob.java
+++ b/github-plugin/src/main/java/com/googlesource/gerrit/plugins/github/git/PullRequestImportJob.java
@@ -153,10 +153,10 @@
} catch (OrmException e1) {
LOG.error("Error rolling back transation", e1);
}
- } catch (Exception e) {
+ } catch (Throwable e) {
LOG.error("Pull request " + prId + " into repository " + organisation
+ "/" + repoName + " was failed", e);
- status.update(GitJobStatus.Code.FAILED, "Failed", getErrorDescription(e));
+ status.update(GitJobStatus.Code.FAILED, "Failed", e.getLocalizedMessage());
try {
db.rollback();
} catch (OrmException e1) {
@@ -167,10 +167,6 @@
}
}
- private String getErrorDescription(Exception e) {
- return e.getLocalizedMessage();
- }
-
private List<Id> addPullRequestToChange(ReviewDb db, GHPullRequest pr,
Repository gitRepo) throws Exception {
String destinationBranch = pr.getBase().getRef();