Koheron / koheron-sdk

SDK for FPGA / Linux Instruments
https://www.koheron.com/software-development-kit/
Other
101 stars 41 forks source link

Python: catch narrower exception types #602

Closed chrisjbillington closed 5 months ago

chrisjbillington commented 5 months ago

Catch Exception, instead of BaseException or using bare except: clauses.

This is still very broad, but avoids the case of catching SystemExit or KeyboardInterrupt (which are not subclasses of Exception) and re-raising them as ConnectionError.

Application code may handle ConnectionErrors differently (such as attempting re-connection) to SystemExit or KeyboardInterrupt, which may be raised in signal handlers and which the application may treat as a relatively normal shutdown.

tvanderbruggen commented 5 months ago

Makes sense. Thanks.