MCPcopy Index your code
hub / github.com/python/cpython / exception

Method exception

Lib/concurrent/futures/_base.py:457–488  ·  view source on GitHub ↗

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 except

(self, timeout=None)

Source from the content-addressed store, hash-verified

455 self = None
456
457 def exception(self, timeout=None):
458 """Return the exception raised by the call that the future represents.
459
460 Args:
461 timeout: The number of seconds to wait for the exception if the
462 future isn't done. If None, then there is no limit on the wait
463 time.
464
465 Returns:
466 The exception raised by the call that the future represents or None
467 if the call completed without raising.
468
469 Raises:
470 CancelledError: If the future was cancelled.
471 TimeoutError: If the future didn't finish executing before the given
472 timeout.
473 """
474
475 with self._condition:
476 if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
477 raise CancelledError()
478 elif self._state == FINISHED:
479 return self._exception
480
481 self._condition.wait(timeout)
482
483 if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
484 raise CancelledError()
485 elif self._state == FINISHED:
486 return self._exception
487 else:
488 raise TimeoutError()
489
490 # The following methods should only be used by Executors and in tests.
491 def set_running_or_notify_cancel(self):

Callers 3

waitFunction · 0.45
_invoke_callbacksMethod · 0.45
add_done_callbackMethod · 0.45

Calls 3

TimeoutErrorClass · 0.85
CancelledErrorClass · 0.70
waitMethod · 0.45

Tested by

no test coverage detected