src/org/myorg/myscclient/HTTPLevelErrorException.java

package org.myorg.myscclient;

import java.io.IOException;
import org.apache.http.HttpResponse;


class HTTPLevelErrorException extends IOException {

    private static final String errorMessageTemplate = "Service Invocation failed because: %1$s : %2$s"; //NOI18N

    private int code;
    private String description;

    public HTTPLevelErrorException(HttpResponse response) {
        super(String.format(errorMessageTemplate,
                response.getStatusLine().getStatusCode(),
                response.getStatusLine().getReasonPhrase()));
        this.code = response.getStatusLine().getStatusCode();
        this.description = response.getStatusLine().getReasonPhrase();
    }

    public int getStatusCode() {
        return code;
    }

    public String getStatusDescription() {
        return description;
    }
}