DiamondLightSource / DiamondLightSource/cothread
Exceptions raised in `Spawn`ed cothread can be lost
Open
cannot fix
- Dominant language
- C
- Stars
- 13
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
The `Spawn` option `raise_on_wait` causes reporting of any exception terminating the spawned cothread to be deferred until `.Wait()` is called on the associated cothread, for instance:
```python
def task(): raise Exception('Die')
def test():
action = Spawn(task, raise_on_wait = True)
action.Wait()
```
Unfortunately if `.Wait()` is never called then the associated exception is never reported.
It _might_ be possible to fix this by added a `__del__` method to `Spawn` and reporting any exception that hasn't already been reported.
Contributor guide
Assessment
This issue has not been assessed yet.