Skip to content

Commit

Permalink
don't return 500 for 404 in ExceptionMapper
Browse files Browse the repository at this point in the history
  • Loading branch information
lennartkoopmann committed Aug 27, 2020
1 parent 68f95d2 commit 1beaf29
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/horse/wtf/nzyme/rest/NzymeExceptionMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
Expand All @@ -31,6 +32,10 @@ public class NzymeExceptionMapper implements ExceptionMapper<Throwable> {

@Override
public Response toResponse(Throwable t) {
if (t instanceof NotFoundException) {
return Response.status(Response.Status.NOT_FOUND).build();
}

LOG.error("Error while handling REST call.", t);
return Response.serverError().build();
}
Expand Down

0 comments on commit 1beaf29

Please sign in to comment.