title: Handling multiple exceptions
body: <p>I have written a class which loads configuration objects of my application and keeps track of them so that I can easily write out changes or reload the whole configuration at once with a single method call. However, each configuration object might potentially throw an exception when doing IO, yet I do not want those errors to cancel the overall process in order to give the other objects still a chance to reload/write. Therefore I collect all exceptions which are thrown while iterating over the objects and store them in a super-exception, which is thrown after the loop, since each exception must still be handled and someone has to be notified of what exactly went wrong. However, that approach looks a bit odd to me. Someone out there with a cleaner solution? </p>
  
  <p>Here is some code of the mentioned class:</p>
  
  <pre><code>public synchronized void store() throws MultipleCauseException
      {
      MultipleCauseException me = new MultipleCauseException("unable to store some resources");
      for(Resource resource : this.resources.values())
          {
          try
              {
              resource.store();
              }
          catch(StoreException e)
              {
              me.addCause(e);
              }
          }
      if(me.hasCauses())
          throw me;
      }
  </code></pre>