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

com.microsoft.bingads.v13.bulk.BulkUploadCouldNotBeCompletedException Maven / Gradle / Ivy

Go to download

The Bing Ads Java SDK is a library improving developer experience when working with the Bing Ads services by providing high-level access to features such as Bulk API, OAuth Authorization and SOAP API.

There is a newer version: 13.0.22.1
Show newest version
package com.microsoft.bingads.v13.bulk;

import java.util.List;

/**
 * This exception is thrown if an attempt was made to poll for a completed bulk upload results file and the bulk service returns a failed status.
 */
public class BulkUploadCouldNotBeCompletedException extends RuntimeException {
    
    private final List errors;

    private final UploadStatus status;

    public BulkUploadCouldNotBeCompletedException(List errors, UploadStatus status) {
        this.errors = errors;

        this.status = status;
    }

    public BulkUploadCouldNotBeCompletedException(List errors, UploadStatus status, String message) {
        super(message);

        this.errors = errors;

        this.status = status;
    }

    public List getErrors() {
        return errors;
    }

    public UploadStatus getStatus() {
        return status;
    }
    
    @Override
    public String toString() {
        if (errors == null) {
            return String.format("%s Upload status is %s", super.toString(), status);
        }
        
    	StringBuilder errorsInfo = new StringBuilder();
    	
    	for(OperationError error : errors) {
    		errorsInfo.append(String.format("code=%d, details=%s, errorCode=%s, message=%s; ", error.getCode(), error.getDetails(), error.getErrorCode(), error.getMessage()));
    	}
    	
        return String.format("%s Upload status is %s, errors are %s", super.toString(), status, errorsInfo);    
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy