'Runs a callback with error handling.
For use in subclasses.'

def _run_callback(self, callback):

    try:
        ret = callback()
        if (ret is not None):
            from tornado import gen
            try:
                ret = gen.convert_yielded(ret)
            except gen.BadYieldError:
                pass
            else:
                self.add_future(ret, self._discard_future_result)
    except Exception:
        self.handle_callback_exception(callback)
