Add support for inclusion of opaque error data in abort-step in data entry flow
Context
The data entry flow is great for guiding a user through the process of doing "something", e.g. adding a new integration. Something I am missing is the possibility to include additional data that can be used for troubleshooting when something goes wrong. Today error messages can be logged (which is hard for the user to find) or condensed into some generic message (that is translatable) but lose valuable information (e.g. stack trace).
Proposal
It should be easy for the user to get hold of the error message (often an exception stack trace as I would imagine), but it should not be intrusive and needs not necessarily be "understandable" by the end user. It should be there in case the user decides to write an issue for instance. The actual exception will be sitting right there, easy enough to copy.
My suggestion is to add small "arrow" that expands a scrollable textbox with the error message. Or even just a "copy" button with some explanatory text. The message itself could be passed to async_abort as an additional argument:
def async_some_step(self):
try:
dev = find_device()
exception DeviceNotFound as ex:
return self.async_abort(reason="device_not_found", error=ex)
If an exception is passed, the entire stack trace should be shown. Otherwise treat it as a string.
Consequences
Hopefully this makes it easier for a user to provide more detailed error messages when writing issues. For some users, it might simplify troubleshooting by just looking at the stack trace (especially more advanced users). It potentially adds some additional clutter to the UI, so some care has to be taken to make it right. It is however opt-in, so no one will be forced into this.