mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 23:45:44 +01:00
19 lines
506 B
Java
19 lines
506 B
Java
package sonia.scm.api.rest;
|
|
|
|
import sonia.scm.AlreadyExistsException;
|
|
|
|
import javax.ws.rs.core.Response;
|
|
import javax.ws.rs.core.Response.Status;
|
|
import javax.ws.rs.ext.ExceptionMapper;
|
|
import javax.ws.rs.ext.Provider;
|
|
|
|
@Provider
|
|
public class AlreadyExistsExceptionMapper implements ExceptionMapper<AlreadyExistsException> {
|
|
@Override
|
|
public Response toResponse(AlreadyExistsException exception) {
|
|
return Response.status(Status.CONFLICT)
|
|
.entity(exception.getMessage())
|
|
.build();
|
|
}
|
|
}
|