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

Method exception

Lib/asyncio/futures.py:215–228  ·  view source on GitHub ↗

Return the exception that was set on this future. The exception (or None if no exception was set) is returned only if the future is done. If the future has been cancelled, raises CancelledError. If the future isn't done yet, raises InvalidStateError.

(self)

Source from the content-addressed store, hash-verified

213 return self._result
214
215 def exception(self):
216 """Return the exception that was set on this future.
217
218 The exception (or None if no exception was set) is returned only if
219 the future is done. If the future has been cancelled, raises
220 CancelledError. If the future isn't done yet, raises
221 InvalidStateError.
222 """
223 if self._state == _CANCELLED:
224 raise self._make_cancelled_error()
225 if self._state != _FINISHED:
226 raise exceptions.InvalidStateError('Exception is not set.')
227 self.__log_traceback = False
228 return self._exception
229
230 def add_done_callback(self, fn, *, context=None):
231 """Add a callback to be run when the future becomes done.

Callers 15

traceFunction · 0.45
print_excFunction · 0.45
format_excFunction · 0.45
_error_excMethod · 0.45
_error_excMethod · 0.45
_post_mortemFunction · 0.45
__exit__Method · 0.45
__aexit__Method · 0.45
_on_completionFunction · 0.45
_done_callbackFunction · 0.45
_log_on_exceptionFunction · 0.45

Calls 1

_make_cancelled_errorMethod · 0.95

Tested by 1

mainFunction · 0.36