CreateChange: Don't swallow caught exceptions
Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: Ie6a5c83196e1ce2c85639a5bd2e1937902f54882
diff --git a/java/com/google/gerrit/server/restapi/change/CreateChange.java b/java/com/google/gerrit/server/restapi/change/CreateChange.java
index 53a20a94..4d0b3f1 100644
--- a/java/com/google/gerrit/server/restapi/change/CreateChange.java
+++ b/java/com/google/gerrit/server/restapi/change/CreateChange.java
@@ -278,7 +278,7 @@
try {
permissionBackend.currentUser().project(project).ref(refName).check(RefPermission.READ);
} catch (AuthException e) {
- throw new ResourceNotFoundException(String.format("ref %s not found", refName));
+ throw new ResourceNotFoundException(String.format("ref %s not found", refName), e);
}
permissionBackend
@@ -342,7 +342,7 @@
}
return ins.getChange();
} catch (IllegalArgumentException e) {
- throw new BadRequestException(e.getMessage());
+ throw new BadRequestException(e.getMessage(), e);
}
}
@@ -356,7 +356,7 @@
try {
permissionBackend.currentUser().change(change).check(ChangePermission.READ);
} catch (AuthException e) {
- throw new UnprocessableEntityException("Read not permitted for " + baseChange);
+ throw new UnprocessableEntityException("Read not permitted for " + baseChange, e);
}
return change;
@@ -384,14 +384,15 @@
parentCommit = ObjectId.fromString(baseCommit);
} catch (InvalidObjectIdException e) {
throw new UnprocessableEntityException(
- String.format("Base %s doesn't represent a valid SHA-1", baseCommit));
+ String.format("Base %s doesn't represent a valid SHA-1", baseCommit), e);
}
RevCommit parentRevCommit;
try {
parentRevCommit = revWalk.parseCommit(parentCommit);
} catch (MissingObjectException e) {
- throw new UnprocessableEntityException(String.format("Base %s doesn't exist", baseCommit));
+ throw new UnprocessableEntityException(
+ String.format("Base %s doesn't exist", baseCommit), e);
}
if (destRef == null) {