-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modify error handling for timed out signals when connecting. #97
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely the right idea and I'm onboard, see individual comments and also the following about approach:
The approach in most default devices seems to be:
try:
some_device_specific_connection()
except TimeoutError: # or CANothing or similar
raise ConnectionTimeoutError(some_device_specific_source)
Does this lose us information from the original error? Would we not be better off with something like this?
try:
some_device_specific_connection()
except TimeoutError as ex: # or CANothing or similar
raise ConnectionTimeoutError(some_device_specific_source) from ex
261e3ad
to
5183317
Compare
This commit puts responsibility on anything with a .connect method to raise its own ConnectionTimeoutError, to be then picked up by the DeviceCollector, or not. This simplifies the complex error handling requiring timeouts to be handled at the asyncio level and passed up the called via (now redefined) NotConnected exceptions.
938b8a8
to
33427af
Compare
81b77bf
to
2e337d9
Compare
Connection timeouts now result in a logging.debug, all other exceptions result in a logging.exception. All the errors are propogated to the device collector or top level device and a formatted NotConnected error is outputted
2e337d9
to
00ce76f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's discuss the string formatting offline
8ab530e
to
181575f
Compare
181575f
to
52b3001
Compare
52b3001
to
c42db05
Compare
f9e45ab
to
da391b1
Compare
da391b1
to
7cba553
Compare
This commit puts responsibility on anything with a .connect method to raise its own ConnectionTimeoutError, to be then picked up by the DeviceCollector, or not. This simplifies the complex error handling requiring timeouts to be handled at the asyncio level and passed up the called via (now redefined) NotConnected exceptions.
fixes #48