Add handling when duplicated branch part cannot be created (#1692)

Add handling when duplicated branch cannot be created because a part of the name already exists as a branch
This commit is contained in:
Florian Scholdei
2021-06-09 14:58:59 +02:00
committed by GitHub
parent 35fe536170
commit f274b7f4b2
8 changed files with 112 additions and 9 deletions

View File

@@ -37,6 +37,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sonia.scm.AlreadyExistsException;
import sonia.scm.BadRequestException;
import sonia.scm.BranchAlreadyExistsException;
import sonia.scm.ConcurrentModificationException;
import sonia.scm.NotFoundException;
import sonia.scm.ScmConstraintViolationException;
@@ -91,6 +92,7 @@ public class RestDispatcher {
public EnhanceableExceptionMapper() {
registerException(NotFoundException.class, Status.NOT_FOUND);
registerException(AlreadyExistsException.class, Status.CONFLICT);
registerException(BranchAlreadyExistsException.class, Status.CONFLICT);
registerException(ConcurrentModificationException.class, Status.CONFLICT);
registerException(UnauthorizedException.class, Status.FORBIDDEN);
registerException(AuthorizationException.class, Status.FORBIDDEN);