ezmsg-org / ezmsg

Pure-Python DAG-based high-performance SHM-backed pub-sub and multi-processing pattern
https://ezmsg.readthedocs.io/en/latest/
MIT License
9 stars 4 forks source link

try/catch TypeError hides bad settings kwargs passed directly to Unit #108

Closed cboulay closed 1 month ago

cboulay commented 3 months ago

In d87811c1320e929703deeda214b17611174e8c1b I made it so we could pass args and kwargs directly to the Unit initializer and these will be used to initialize the Unit's SETTINGS. However, if the kwargs are incorrect (e.g., typo), this raises a TypeError that gets swallowed by the try/catch block, and the unit ends up with no settings.

An easy solution is to scope the try/catch down to just the the final settings = self.__class__.__settings_type__() in the else condition in the if/else block.

griffinmilsap commented 2 months ago

Yeah, cool; your commit addresses this, and I can't fathom why this change would break anything. Another contribution I'd be happy to have in dev/main.