org.fcrepo.http.commons.exceptionhandlers.PathNotFoundExceptionMapper Maven / Gradle / Ivy
/*
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree.
*/
package org.fcrepo.http.commons.exceptionhandlers;
import static org.slf4j.LoggerFactory.getLogger;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
import org.fcrepo.kernel.api.exception.PathNotFoundException;
import org.slf4j.Logger;
/**
* Catch PathNotFoundException
*
* @author robyj
*/
@Provider
public class PathNotFoundExceptionMapper implements
ExceptionMapper, ExceptionDebugLogging {
private static final Logger LOGGER =
getLogger(PathNotFoundExceptionMapper.class);
@Override
public Response toResponse(final PathNotFoundException e) {
debugException(this, e, LOGGER);
return Response.status(Response.Status.NOT_FOUND).
entity("Error: " + e.getMessage()).build();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy