Improve mapping for AuthException on Git layer

Client errors (like an authentication issue) shouldn't be prefixed by
"internal server error: " when Gerrit rejects a commit upload. We
already have special handling for BadRequestException and
UnprocessableEntityException, which we now extend to AuthException.

Change-Id: I126d89dd8d296d20a3cf0b0fbe73d337b2e35320
This commit is contained in:
Alice Kober-Sotzek
2019-01-22 11:32:35 +01:00
parent 5ac0d6df9c
commit 27ad9180f3

View File

@@ -833,7 +833,7 @@ class ReceiveCommits {
} catch (ResourceConflictException e) {
addError(e.getMessage());
reject(magicBranchCmd, "conflict");
} catch (BadRequestException | UnprocessableEntityException e) {
} catch (BadRequestException | UnprocessableEntityException | AuthException e) {
logger.atFine().withCause(e).log("Rejecting due to client error");
reject(magicBranchCmd, e.getMessage());
} catch (RestApiException | IOException e) {