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

com.teamscale.jacoco.agent.upload.UploaderException 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.upload;

import okhttp3.ResponseBody;
import retrofit2.Response;

import java.io.IOException;

/**
 * Exception thrown from an uploader. Either during the upload or in the validation process.
 */
public class UploaderException extends Exception {

	/** Constructor */
	public UploaderException(String message, Exception e) {
		super(message, e);
	}

	/** Constructor */
	public UploaderException(String message) {
		super(message);
	}

	/** Constructor */
	public UploaderException(String message, Response response) {
		super(createResponseMessage(message, response));
	}

	private static String createResponseMessage(String message, Response response) {
		try {
			String errorBodyMessage = response.errorBody().string();
			return String.format("%s (%s): \n%s", message, response.code(), errorBodyMessage);
		} catch (IOException | NullPointerException e) {
			return message;
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy