You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This module appears to directly raise ValueError and RuntimeError under specific circumstances. While both are technically accurate, they necessitate use of overly broad except clauses when dealing with error handling for the module, which makes it difficult to verify that code using the module is actually correct and can't accidentally hide other errors. The RuntimeError usage is particularly problematic, as it's very rare in the core language to ever catch a RuntimeError, so any code that catches one tends to look rather out of place to many people.
I would suggest switching to the same methodology that's used by much of the Python ecosystem of defining local sub-classes of Exception (or whatever specific error makes sense) and raising those instead of directly raising built-in exception types.
The text was updated successfully, but these errors were encountered:
hiya, if you'd like to submit a PR for an update, we'd love to have one - note that this code must be able to run on CircuitPython boards that have very limited RAM
@tannewt Testing should be the only issue (I'm a bit out of practice with Python in general, but that shouldn't be a problem for something like this). I've never worked with CircuitPython myself (as mentioned in the issue description, this was prompted by a PR for Netdata to add a data collector that uses this module), so I'm not sure where exactly the best place to begin would be.
Prompted by: netdata/netdata#7024
This module appears to directly raise
ValueError
andRuntimeError
under specific circumstances. While both are technically accurate, they necessitate use of overly broadexcept
clauses when dealing with error handling for the module, which makes it difficult to verify that code using the module is actually correct and can't accidentally hide other errors. TheRuntimeError
usage is particularly problematic, as it's very rare in the core language to ever catch aRuntimeError
, so any code that catches one tends to look rather out of place to many people.I would suggest switching to the same methodology that's used by much of the Python ecosystem of defining local sub-classes of
Exception
(or whatever specific error makes sense) and raising those instead of directly raising built-in exception types.The text was updated successfully, but these errors were encountered: