ErrorState

class lib.multithreading.ErrorState

Bases: object

An object for tracking error state across threads

The “set” method should be called from within a thread to set the thread error traceback

The “check_and_raise” method should be called from the main thread to check for and re-raise any errors

Attributes Summary

has_error

Check whether any running FSThread thread has an error.

Methods Summary

clear()

Clear any stored errors

re_raise()

Check if a thread error is stored and re-raise it if so.

set(exc_info)

Set the error traceback information to the error state object.

Attributes Documentation

has_error

Check whether any running FSThread thread has an error.

Return type:

True if an FSThread has an error

Methods Documentation

clear() None

Clear any stored errors

Return type:

None

re_raise() None

Check if a thread error is stored and re-raise it if so. Should be called from main thread. Only the first error received is re-raised (in the event of multiple errors)

Return type:

None

set(exc_info: tuple[type[BaseException], BaseException, TracebackType] | tuple[Any, Any, Any]) None

Set the error traceback information to the error state object. Errors are appended to the error list in the order that they are received

Parameters:
  • set (The traceback error information to)

  • exc_info (tuple[type[BaseException], BaseException, TracebackType] | tuple[Any, Any, Any])

Return type:

None

clear() None

Clear any stored errors

Return type:

None

errors: list[tuple[type[BaseException], BaseException, TracebackType] | tuple[Any, Any, Any]]

list of errors that have been detected within threads

property has_error: bool

Check whether any running FSThread thread has an error.

Return type:

True if an FSThread has an error

re_raise() None

Check if a thread error is stored and re-raise it if so. Should be called from main thread. Only the first error received is re-raised (in the event of multiple errors)

Return type:

None

set(exc_info: tuple[type[BaseException], BaseException, TracebackType] | tuple[Any, Any, Any]) None

Set the error traceback information to the error state object. Errors are appended to the error list in the order that they are received

Parameters:
  • set (The traceback error information to)

  • exc_info (tuple[type[BaseException], BaseException, TracebackType] | tuple[Any, Any, Any])

Return type:

None