Книга: Learning Concurrency in Python
Назад: Chaining callbacks
Дальше: Example

Exception classes

In the previous chapter, we looked at how you could handle exceptions within normal child threads in Python by utilizing a queue primitive in order to pass the exception from the child thread to another thread. This was, however, somewhat hacky in the way that things were done, and, thankfully, with ThreadPoolExecutors, we no longer have to worry about this, as it's all handled for us.

In the same way that we retrieve the results from our future objects, so too can we return the exceptions.

Назад: Chaining callbacks
Дальше: Example