MCPcopy Index your code
hub / github.com/RustPython/RustPython / exception

Method exception

Lib/concurrent/futures/_base.py:463–494  ·  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

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