mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 23:45:44 +01:00
Log illegal argument exception before mapping to 400
This commit is contained in:
@@ -33,6 +33,8 @@ package sonia.scm.api.rest;
|
|||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.Response.Status;
|
import javax.ws.rs.core.Response.Status;
|
||||||
import javax.ws.rs.ext.ExceptionMapper;
|
import javax.ws.rs.ext.ExceptionMapper;
|
||||||
@@ -43,7 +45,7 @@ import javax.ws.rs.ext.Provider;
|
|||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
* @since 1.36
|
* @since 1.36
|
||||||
*/
|
*/
|
||||||
@Provider
|
@Provider @Slf4j
|
||||||
public class IllegalArgumentExceptionMapper
|
public class IllegalArgumentExceptionMapper
|
||||||
implements ExceptionMapper<IllegalArgumentException>
|
implements ExceptionMapper<IllegalArgumentException>
|
||||||
{
|
{
|
||||||
@@ -59,6 +61,7 @@ public class IllegalArgumentExceptionMapper
|
|||||||
@Override
|
@Override
|
||||||
public Response toResponse(IllegalArgumentException exception)
|
public Response toResponse(IllegalArgumentException exception)
|
||||||
{
|
{
|
||||||
|
log.info("caught IllegalArgumentException -- mapping to bad request", exception);
|
||||||
return Response.status(Status.BAD_REQUEST).build();
|
return Response.status(Status.BAD_REQUEST).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user