(self, timeout=None)
Return the exception raised by the call that the future represents.

        Args:
            timeout: The number of seconds to wait for the exception if the
                future isn't done. If None, then there is no limit on the wait
                time.

        Returns:
            The exception raised by the call that the future represents or None
            if the call completed without raising.

        Raises:
            CancelledError: If the future was cancelled.
            TimeoutError: If the future didn't finish executing before the given
                timeout.
Return the exception raised by the call that the future represents.
Return the exception raised by the call that the future represents .
def exception(self, timeout=None):
        """Return the exception raised by the call that the future represents.

        Args:
            timeout: The number of seconds to wait for the exception if the
                future isn't done. If None, then there is no limit on the wait
                time.

        Returns:
            The exception raised by the call that the future represents or None
            if the call completed without raising.

        Raises:
            CancelledError: If the future was cancelled.
            TimeoutError: If the future didn't finish executing before the given
                timeout.
        """

        with self._condition:
            if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
                raise CancelledError()
            elif self._state == FINISHED:
                return self._exception

            self._condition.wait(timeout)

            if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
                raise CancelledError()
            elif self._state == FINISHED:
                return self._exception
            else:
                raise TimeoutError()
def exception ( self , timeout = None ) : with self . _condition : if self . _state in [ CANCELLED , CANCELLED_AND_NOTIFIED ] : raise CancelledError ( ) elif self . _state == FINISHED : return self . _exception self . _condition . wait ( timeout ) if self . _state in [ CANCELLED , CANCELLED_AND_NOTIFIED ] : raise CancelledError ( ) elif self . _state == FINISHED : return self . _exception else : raise TimeoutError ( )