title: Java, Catching an exception and passing it to a method
body: <p>I created a method that accepts an IOException as an argument.  This method opens the out stream and prints information about the exception to a text file.  My problem that I seem to be running into.. How to call that method from a catch block?</p>
  
  <pre><code>try{
      if(true)
          throw new IOException();
  }
  catch(IOException e){
      //pass it to a method
  }
  </code></pre>
  
  <p>:::EDIT:::</p>
  
  <pre><code>public void logErrors(IOException e){
      PrintWriter out = yada yada;
  
      out.println(e.getCause());
  }
  </code></pre>