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

com.elastisys.scale.cloudpool.splitter.MultiCauseException Maven / Gradle / Ivy

Go to download

A cloud pool that uses a configured list of child cloud pools to carry out operations.

The newest version!
package com.elastisys.scale.cloudpool.splitter;

import java.util.Collection;
import java.util.List;

import com.google.common.collect.ImmutableList;

/**
 * An exception that can be used when an exceptional condition is a result of
 * multiple errors.
 */
public class MultiCauseException extends Throwable {

	private static final long serialVersionUID = 1L;
	/** The exceptions that caused this one. */
	private final List causes;

	/**
	 * Create a {@link MultiCauseException} with a collection of causes.
	 * 
	 * @param causes
	 *            The error causes.
	 */
	public MultiCauseException(Collection causes) {
		super();
		this.causes = ImmutableList.copyOf(causes);
	}

	@Override
	public String getMessage() {
		StringBuilder builder = new StringBuilder();
		// builder.append(getClass().getName() + ": ");
		builder.append("[");
		for (int i = 0; i < this.causes.size(); i++) {
			if (i > 0) {
				builder.append(", ");
			}
			builder.append("\"");
			builder.append(this.causes.get(i).getMessage());
			builder.append("\"");
		}
		builder.append("]");
		return builder.toString();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy