def set_data_from_mendeley(self, high_priority=False): # set_altmetric_api_raw catches its own errors, but since this is the method # called by the thread from Person.set_data_from_altmetric_for_all_products # want to have defense in depth and wrap this whole thing in a try/catch too # in case errors in calculate or anything else we add. try: self.mendeley_api_raw = set_mendeley_data(self) except (KeyboardInterrupt, SystemExit): # let these ones through, don't save anything to db raise except Exception: logging.exception("exception in set_data_from_mendeley") self.error = "error in set_data_from_mendeley" print self.error print u"in generic exception handler, so rolling back in case it is needed" db.session.rollback()