package sklep.rest.ext;

import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;

import sklep.db.RecordNotFound;

@Provider
public class RecordNotFoundMapper implements ExceptionMapper<RecordNotFound> {

	@Override
	public Response toResponse(RecordNotFound e) {
		String html = "<html><body><h1>Nie znaleziono</h1><p style='color:red'>" + e.getMessage()	+ "</p></body></html>";
		return Response.status(404)
				.type("text/html")
				.entity(html)
				.build();
	}

}
