Class ClusterException

All Implemented Interfaces:
Serializable

final class ClusterException extends RuntimeException
An ClusterException is a data structure that allows for some code to "throw multiple exceptions", or something close to it. The prototypical code that calls for this class is presented below:
 void runManyThings(List<ThingToRun> thingsToRun) {
   for (ThingToRun thingToRun : thingsToRun) {
     thingToRun.run(); // say this may throw an exception, but you want to
                       // always run all thingsToRun
   }
 }
 

This is what the code would become:

 void runManyThings(List<ThingToRun> thingsToRun) {
   List<Exception> exceptions = Lists.newArrayList();
   for (ThingToRun thingToRun : thingsToRun) {
     try {
       thingToRun.run();
     } catch (Exception e) {
       exceptions.add(e);
     }
   }
   if (exceptions.size() > 0) {
     throw ClusterException.create(exceptions);
   }
 }
 

See semantic details at create(Collection).