Handle HomeKit configuration failure more cleanly#14041
Handle HomeKit configuration failure more cleanly#14041balloob merged 2 commits intohome-assistant:devfrom
Conversation
There was a problem hiding this comment.
indentation contains mixed spaces and tabs
There was a problem hiding this comment.
indentation contains tabs
indentation contains mixed spaces and tabs
There was a problem hiding this comment.
indentation contains mixed spaces and tabs
There was a problem hiding this comment.
indentation contains tabs
indentation contains mixed spaces and tabs
Add support for handling cases where HomeKit configuration fails, and give the user more information about what to do.
OttoWinter
left a comment
There was a problem hiding this comment.
Looking good 👍 Just a small comment that might help with debugging issues in the future - I don't know the homekit pypi module so the comment might very well also not be necessary.
| except homekit.exception.UnknownError: | ||
| error_msg = "Received an unknown error. Please file a bug." | ||
| _configurator = self.hass.data[DOMAIN+self.hkid] | ||
| self.configurator.notify_errors(_configurator, error_msg) |
There was a problem hiding this comment.
If it's an unknown error, wouldn't it be good to print the stack trace? If I understand correctly, when an UnknownError is thrown the only message that's displayed is "Received an unknown error. [...]" and debugging an issue is going to be difficult with just that error message.
Maybe replace the return on the line below withraise so that a) the configurator still shows an error but b) the complete stack trace is shown?
There was a problem hiding this comment.
That seems reasonable. The problem with UnknownError is that the device literally returned what the HomeKit spec defines as an unknown error, so it's unlikely that we're going to get much more from the stack trace, but it's going to be better than nothing.
If we get an UnknownError then we should alert the user but also still generate the backtrace so there's actually something for them to file in a bug report.
* Handle HomeKit configuration failure more cleanly Add support for handling cases where HomeKit configuration fails, and give the user more information about what to do. * Don't consume the exception for a homekit.UnknownError If we get an UnknownError then we should alert the user but also still generate the backtrace so there's actually something for them to file in a bug report.
Add support for handling cases where HomeKit configuration fails, and give
the user more information about what to do.