Catch IPPVersionNotSupportedError in IPP (#34184)
* Update config_flow.py * squash. * Update test_config_flow.py * Update config_flow.py * Update test_config_flow.py * Update test_config_flow.py * Update test_config_flow.py * Update test_config_flow.py * Update test_config_flow.py
This commit is contained in:
parent
e0a7ea52fd
commit
e268c5b873
7 changed files with 90 additions and 6 deletions
|
@ -6,8 +6,10 @@ from pyipp import (
|
|||
IPP,
|
||||
IPPConnectionError,
|
||||
IPPConnectionUpgradeRequired,
|
||||
IPPError,
|
||||
IPPParseError,
|
||||
IPPResponseError,
|
||||
IPPVersionNotSupportedError,
|
||||
)
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -70,10 +72,16 @@ class IPPFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
except IPPConnectionUpgradeRequired:
|
||||
return self._show_setup_form({"base": "connection_upgrade"})
|
||||
except (IPPConnectionError, IPPResponseError):
|
||||
_LOGGER.debug("IPP Connection/Response Error", exc_info=True)
|
||||
return self._show_setup_form({"base": "connection_error"})
|
||||
except IPPParseError:
|
||||
_LOGGER.exception("IPP Parse Error")
|
||||
_LOGGER.debug("IPP Parse Error", exc_info=True)
|
||||
return self.async_abort(reason="parse_error")
|
||||
except IPPVersionNotSupportedError:
|
||||
return self.async_abort(reason="ipp_version_error")
|
||||
except IPPError:
|
||||
_LOGGER.debug("IPP Error", exc_info=True)
|
||||
return self.async_abort(reason="ipp_error")
|
||||
|
||||
user_input[CONF_UUID] = info[CONF_UUID]
|
||||
|
||||
|
@ -111,10 +119,16 @@ class IPPFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||
except IPPConnectionUpgradeRequired:
|
||||
return self.async_abort(reason="connection_upgrade")
|
||||
except (IPPConnectionError, IPPResponseError):
|
||||
_LOGGER.debug("IPP Connection/Response Error", exc_info=True)
|
||||
return self.async_abort(reason="connection_error")
|
||||
except IPPParseError:
|
||||
_LOGGER.exception("IPP Parse Error")
|
||||
_LOGGER.debug("IPP Parse Error", exc_info=True)
|
||||
return self.async_abort(reason="parse_error")
|
||||
except IPPVersionNotSupportedError:
|
||||
return self.async_abort(reason="ipp_version_error")
|
||||
except IPPError:
|
||||
_LOGGER.debug("IPP Error", exc_info=True)
|
||||
return self.async_abort(reason="ipp_error")
|
||||
|
||||
if info[CONF_UUID] is not None:
|
||||
self.discovery_info[CONF_UUID] = info[CONF_UUID]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue