All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.teamscale.jacoco.agent.GenericExceptionMapper Maven / Gradle / Ivy

Go to download

JVM profiler that simplifies various aspects around recording and uploading test coverage

There is a newer version: 34.0.2
Show newest version
package com.teamscale.jacoco.agent;

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

/**
 * Generates a {@link Response} for an exception.
 */
@javax.ws.rs.ext.Provider
public class GenericExceptionMapper implements ExceptionMapper {

	@Override
	public Response toResponse(Throwable e) {
		Response.ResponseBuilder errorResponse = Response.status(Response.Status.INTERNAL_SERVER_ERROR);
		errorResponse.type(MediaType.TEXT_PLAIN_TYPE);
		errorResponse.entity("Message: " + e.getMessage());
		return errorResponse.build();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy