frequenz-floss / frequenz-channels-python

Channel implementations for Python
https://frequenz-floss.github.io/frequenz-channels-python/
MIT License
7 stars 8 forks source link

Remove uses of `BaseException` #280

Closed shsms closed 7 months ago

shsms commented 7 months ago

What happened?

When we iterate over select without consuming a previously selected value, select raises a SelectError that derives from BaseException.

The use of BaseException combined with tasks consuming exceptions makes it hard to identify that anything happened, because a broad except Exception: block doesn't catch BaseExceptions.

The use of BaseException in user code is not recommended according to python docs: https://docs.python.org/3/library/exceptions.html#BaseException

What did you expect instead?

A except Exception: catches select errors. i.e. SelectErrors derive from Exception and not BaseException.

Affected part(s)

Synchronization of multiple sources (select(), merge(), etc.) (part:synchronization)