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

com.atlassian.bamboo.specs.exceptions.BambooSpecsRestRequestException Maven / Gradle / Ivy

There is a newer version: 10.1.0
Show newest version
package com.atlassian.bamboo.specs.exceptions;

import org.jetbrains.annotations.Nullable;

/**
 * Exception thrown when an unexpected REST response was returned from Bamboo server.
 */
public class BambooSpecsRestRequestException extends RuntimeException {
    private final int statusCode;
    private final String responseEntity;

    /**
     * Creates instance of the exception.
     *
     * @param statusCode     HTTP status code returned by server
     * @param errorMessage   error message extracted from the response entity
     * @param responseEntity response entity returned by server
     */
    public BambooSpecsRestRequestException(int statusCode, @Nullable String errorMessage, @Nullable String responseEntity) {
        super(errorMessage);
        this.statusCode = statusCode;
        this.responseEntity = responseEntity;
    }

    /**
     * HTTP status code returned by server.
     */
    public int getStatusCode() {
        return statusCode;
    }

    /**
     * Error message extracted from {@link #getResponseEntity() HTTP response entity}.
     */
    @Override
    @Nullable
    public String getMessage() {
        return super.getMessage();
    }

    /**
     * HTTP response entity returned by server.
     */
    @Nullable
    public String getResponseEntity() {
        return responseEntity;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy