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:
@@ -833,7 +833,7 @@ class ReceiveCommits {
|
|||||||
} catch (ResourceConflictException e) {
|
} catch (ResourceConflictException e) {
|
||||||
addError(e.getMessage());
|
addError(e.getMessage());
|
||||||
reject(magicBranchCmd, "conflict");
|
reject(magicBranchCmd, "conflict");
|
||||||
} catch (BadRequestException | UnprocessableEntityException e) {
|
} catch (BadRequestException | UnprocessableEntityException | AuthException e) {
|
||||||
logger.atFine().withCause(e).log("Rejecting due to client error");
|
logger.atFine().withCause(e).log("Rejecting due to client error");
|
||||||
reject(magicBranchCmd, e.getMessage());
|
reject(magicBranchCmd, e.getMessage());
|
||||||
} catch (RestApiException | IOException e) {
|
} catch (RestApiException | IOException e) {
|
||||||
|
Reference in New Issue
Block a user