title: How do I prevent exceptions from causing a transaction rollback under Grails?
body: <p>My Grails service is having an issue where a swallowed exception unrelated to a transaction is causing the transaction to rollback even when it is unrelated to the persistance of the domain object.</p>
  
  <p>In my service I have something along the lines of</p>
  
  <pre><code>updateSomething(domainObj) {
      def oldFilename = domainObj.filename
      def newFilename = getNewFilename()
  
      domainObj.filename = newFilename
      domainObj.save(flush: true)
  
      try {
          cleanUpOldFile(oldFilename)
      } catch (cleanupException) {
          // oh well, log and swallow
      }
  }
  </code></pre>
  
  <p>What I am seeing is that when I have exception when I am cleaning up the old file, I log it and swallow it, but it still causes the transaction to rollback, even though I am already done updating the domain object.</p>
  
  <p>How do I limit the scope transaction to complete before the clean up or is there another way to get the clean up exception to not cause a rollback?</p>
  
  <p>Just for the record I am using Grails 2.1.1</p>