code: def _commit(self, session, errorMessage):
          
          try:
              session.commit()
          except IntegrityError:
              # Raise special error if the commit fails due to empty files
              log.error('Commit to database failed. %s' % errorMessage)
          except:
              # Raise other errors as normal
              raise
docs: Custom commit function for file objects