diff --git a/homeassistant/components/alexa/entities.py b/homeassistant/components/alexa/entities.py index 61ab220c60c..240f676b5f3 100644 --- a/homeassistant/components/alexa/entities.py +++ b/homeassistant/components/alexa/entities.py @@ -384,10 +384,8 @@ def async_get_entities( try: alexa_entity = ENTITY_ADAPTERS[state.domain](hass, config, state) interfaces = list(alexa_entity.interfaces()) - except Exception as exc: # pylint: disable=broad-except - _LOGGER.exception( - "Unable to serialize %s for discovery: %s", state.entity_id, exc - ) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Unable to serialize %s for discovery", state.entity_id) else: if not interfaces: continue diff --git a/homeassistant/components/alexa/handlers.py b/homeassistant/components/alexa/handlers.py index 30c2fecccf8..c28b1923399 100644 --- a/homeassistant/components/alexa/handlers.py +++ b/homeassistant/components/alexa/handlers.py @@ -126,9 +126,9 @@ async def async_api_discovery( continue try: discovered_serialized_entity = alexa_entity.serialize_discovery() - except Exception as exc: # pylint: disable=broad-except + except Exception: # pylint: disable=broad-except _LOGGER.exception( - "Unable to serialize %s for discovery: %s", alexa_entity.entity_id, exc + "Unable to serialize %s for discovery", alexa_entity.entity_id ) else: discovery_endpoints.append(discovered_serialized_entity) diff --git a/homeassistant/components/alexa/intent.py b/homeassistant/components/alexa/intent.py index 8d266e4a634..fdf72ccce28 100644 --- a/homeassistant/components/alexa/intent.py +++ b/homeassistant/components/alexa/intent.py @@ -94,8 +94,8 @@ class AlexaIntentsView(http.HomeAssistantView): ) ) - except intent.IntentError as err: - _LOGGER.exception(str(err)) + except intent.IntentError: + _LOGGER.exception("Error handling intent") return self.json( intent_error_response(hass, message, "Error handling intent.") ) diff --git a/homeassistant/components/bluetooth/passive_update_processor.py b/homeassistant/components/bluetooth/passive_update_processor.py index b7a7a165f71..b3bf3adf93c 100644 --- a/homeassistant/components/bluetooth/passive_update_processor.py +++ b/homeassistant/components/bluetooth/passive_update_processor.py @@ -376,11 +376,9 @@ class PassiveBluetoothProcessorCoordinator( try: update = self._update_method(service_info) - except Exception as err: # pylint: disable=broad-except + except Exception: # pylint: disable=broad-except self.last_update_success = False - self.logger.exception( - "Unexpected error updating %s data: %s", self.name, err - ) + self.logger.exception("Unexpected error updating %s data", self.name) return if not self.last_update_success: @@ -588,10 +586,10 @@ class PassiveBluetoothDataProcessor(Generic[_T]): """Handle a Bluetooth event.""" try: new_data = self.update_method(update) - except Exception as err: # pylint: disable=broad-except + except Exception: # pylint: disable=broad-except self.last_update_success = False self.coordinator.logger.exception( - "Unexpected error updating %s data: %s", self.coordinator.name, err + "Unexpected error updating %s data", self.coordinator.name ) return diff --git a/homeassistant/components/brunt/config_flow.py b/homeassistant/components/brunt/config_flow.py index 789a5a48bd9..65886c3081c 100644 --- a/homeassistant/components/brunt/config_flow.py +++ b/homeassistant/components/brunt/config_flow.py @@ -38,13 +38,13 @@ async def validate_input(user_input: dict[str, Any]) -> dict[str, str] | None: _LOGGER.warning("Brunt Credentials are incorrect") errors = {"base": "invalid_auth"} else: - _LOGGER.exception("Unknown error when trying to login to Brunt: %s", exc) + _LOGGER.exception("Unknown error when trying to login to Brunt") errors = {"base": "unknown"} except ServerDisconnectedError: _LOGGER.warning("Cannot connect to Brunt") errors = {"base": "cannot_connect"} - except Exception as exc: # pylint: disable=broad-except - _LOGGER.exception("Unknown error when trying to login to Brunt: %s", exc) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Unknown error when trying to login to Brunt") errors = {"base": "unknown"} finally: await bapi.async_close() diff --git a/homeassistant/components/denonavr/media_player.py b/homeassistant/components/denonavr/media_player.py index 2f9b96d9471..25e4cc0119c 100644 --- a/homeassistant/components/denonavr/media_player.py +++ b/homeassistant/components/denonavr/media_player.py @@ -232,12 +232,10 @@ def async_log_errors( func.__name__, err, ) - except DenonAvrError as err: + except DenonAvrError: available = False _LOGGER.exception( - "Error %s occurred in method %s for Denon AVR receiver", - err, - func.__name__, + "Error occurred in method %s for Denon AVR receiver", func.__name__ ) finally: if available and not self.available: diff --git a/homeassistant/components/discord/config_flow.py b/homeassistant/components/discord/config_flow.py index a2747c1d803..a25a86cab3a 100644 --- a/homeassistant/components/discord/config_flow.py +++ b/homeassistant/components/discord/config_flow.py @@ -89,8 +89,8 @@ async def _async_try_connect(token: str) -> tuple[str | None, nextcord.AppInfo | return "invalid_auth", None except (ClientConnectorError, nextcord.HTTPException, nextcord.NotFound): return "cannot_connect", None - except Exception as ex: # pylint: disable=broad-except - _LOGGER.exception("Unexpected exception: %s", ex) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Unexpected exception") return "unknown", None await discord_bot.close() return None, info diff --git a/homeassistant/components/dlink/config_flow.py b/homeassistant/components/dlink/config_flow.py index 52937d26b7d..4613aeb9cef 100644 --- a/homeassistant/components/dlink/config_flow.py +++ b/homeassistant/components/dlink/config_flow.py @@ -121,8 +121,8 @@ class DLinkFlowHandler(ConfigFlow, domain=DOMAIN): user_input[CONF_USERNAME], user_input[CONF_USE_LEGACY_PROTOCOL], ) - except Exception as ex: # pylint: disable=broad-except - _LOGGER.exception("Unexpected exception: %s", ex) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Unexpected exception") return "unknown" if not smartplug.authenticated and smartplug.use_legacy_protocol: return "cannot_connect" diff --git a/homeassistant/components/esphome/config_flow.py b/homeassistant/components/esphome/config_flow.py index 5e166db7092..67e94121e1d 100644 --- a/homeassistant/components/esphome/config_flow.py +++ b/homeassistant/components/esphome/config_flow.py @@ -430,8 +430,8 @@ class EsphomeFlowHandler(ConfigFlow, domain=DOMAIN): except aiohttp.ClientError as err: _LOGGER.error("Error talking to the dashboard: %s", err) return False - except json.JSONDecodeError as err: - _LOGGER.exception("Error parsing response from dashboard: %s", err) + except json.JSONDecodeError: + _LOGGER.exception("Error parsing response from dashboard") return False self._noise_psk = noise_psk diff --git a/homeassistant/components/esphome/entry_data.py b/homeassistant/components/esphome/entry_data.py index da0dae52569..877c099deee 100644 --- a/homeassistant/components/esphome/entry_data.py +++ b/homeassistant/components/esphome/entry_data.py @@ -353,11 +353,11 @@ class RuntimeEntryData: if subscription := self.state_subscriptions.get(subscription_key): try: subscription() - except Exception as ex: # pylint: disable=broad-except + except Exception: # pylint: disable=broad-except # If we allow this exception to raise it will # make it all the way to data_received in aioesphomeapi # which will cause the connection to be closed. - _LOGGER.exception("Error while calling subscription: %s", ex) + _LOGGER.exception("Error while calling subscription") @callback def async_update_device_state(self) -> None: diff --git a/homeassistant/components/faa_delays/config_flow.py b/homeassistant/components/faa_delays/config_flow.py index 5a42c9f7602..935831c467d 100644 --- a/homeassistant/components/faa_delays/config_flow.py +++ b/homeassistant/components/faa_delays/config_flow.py @@ -43,8 +43,8 @@ class FAADelaysConfigFlow(ConfigFlow, domain=DOMAIN): _LOGGER.error("Error connecting to FAA API") errors["base"] = "cannot_connect" - except Exception as error: # pylint: disable=broad-except - _LOGGER.exception("Unexpected exception: %s", error) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" if not errors: diff --git a/homeassistant/components/flipr/config_flow.py b/homeassistant/components/flipr/config_flow.py index 9d177e4c2b6..fb7985b9602 100644 --- a/homeassistant/components/flipr/config_flow.py +++ b/homeassistant/components/flipr/config_flow.py @@ -44,9 +44,9 @@ class FliprConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except (Timeout, ConnectionError): errors["base"] = "cannot_connect" - except Exception as exception: # pylint: disable=broad-except + except Exception: # pylint: disable=broad-except errors["base"] = "unknown" - _LOGGER.exception(exception) + _LOGGER.exception("Unexpected exception") if not errors and not flipr_ids: # No flipr_id found. Tell the user with an error message. diff --git a/homeassistant/components/frontier_silicon/config_flow.py b/homeassistant/components/frontier_silicon/config_flow.py index a9c87cd9d4a..cf775b15138 100644 --- a/homeassistant/components/frontier_silicon/config_flow.py +++ b/homeassistant/components/frontier_silicon/config_flow.py @@ -74,8 +74,8 @@ class FrontierSiliconConfigFlow(ConfigFlow, domain=DOMAIN): self._webfsapi_url = await AFSAPI.get_webfsapi_endpoint(device_url) except FSConnectionError: errors["base"] = "cannot_connect" - except Exception as exception: # pylint: disable=broad-except - _LOGGER.exception(exception) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: return await self._async_step_device_config_if_needed() @@ -206,8 +206,8 @@ class FrontierSiliconConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidPinException: errors["base"] = "invalid_auth" - except Exception as exception: # pylint: disable=broad-except - _LOGGER.exception(exception) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: if self._reauth_entry: diff --git a/homeassistant/components/google_cloud/tts.py b/homeassistant/components/google_cloud/tts.py index 6f4751850aa..cd5c53b5fd7 100644 --- a/homeassistant/components/google_cloud/tts.py +++ b/homeassistant/components/google_cloud/tts.py @@ -295,7 +295,7 @@ class GoogleCloudTTSProvider(Provider): except TimeoutError as ex: _LOGGER.error("Timeout for Google Cloud TTS call: %s", ex) - except Exception as ex: # pylint: disable=broad-except - _LOGGER.exception("Error occurred during Google Cloud TTS call: %s", ex) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Error occurred during Google Cloud TTS call") return None, None diff --git a/homeassistant/components/google_tasks/config_flow.py b/homeassistant/components/google_tasks/config_flow.py index 14cd89fcec7..a8e283b55c8 100644 --- a/homeassistant/components/google_tasks/config_flow.py +++ b/homeassistant/components/google_tasks/config_flow.py @@ -53,7 +53,7 @@ class OAuth2FlowHandler( reason="access_not_configured", description_placeholders={"message": error}, ) - except Exception as ex: # pylint: disable=broad-except - self.logger.exception("Unknown error occurred: %s", ex) + except Exception: # pylint: disable=broad-except + self.logger.exception("Unknown error occurred") return self.async_abort(reason="unknown") return self.async_create_entry(title=self.flow_impl.name, data=data) diff --git a/homeassistant/components/google_translate/tts.py b/homeassistant/components/google_translate/tts.py index df7130e09e0..c34713caef7 100644 --- a/homeassistant/components/google_translate/tts.py +++ b/homeassistant/components/google_translate/tts.py @@ -162,8 +162,8 @@ class GoogleProvider(Provider): try: tts.write_to_fp(mp3_data) - except gTTSError as exc: - _LOGGER.exception("Error during processing of TTS request %s", exc) + except gTTSError: + _LOGGER.exception("Error during processing of TTS request") return None, None return "mp3", mp3_data.getvalue() diff --git a/homeassistant/components/here_travel_time/config_flow.py b/homeassistant/components/here_travel_time/config_flow.py index d27ea577c29..36d5c1efe1e 100644 --- a/homeassistant/components/here_travel_time/config_flow.py +++ b/homeassistant/components/here_travel_time/config_flow.py @@ -124,8 +124,8 @@ class HERETravelTimeConfigFlow(ConfigFlow, domain=DOMAIN): await async_validate_api_key(user_input[CONF_API_KEY]) except HERERoutingUnauthorizedError: errors["base"] = "invalid_auth" - except (HERERoutingError, HERETransitError) as error: - _LOGGER.exception("Unexpected exception: %s", error) + except (HERERoutingError, HERETransitError): + _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" if not errors: self._config = user_input diff --git a/homeassistant/components/homewizard/config_flow.py b/homeassistant/components/homewizard/config_flow.py index 70ef47a4f03..06dbb9c8333 100644 --- a/homeassistant/components/homewizard/config_flow.py +++ b/homeassistant/components/homewizard/config_flow.py @@ -201,7 +201,7 @@ class HomeWizardConfigFlow(ConfigFlow, domain=DOMAIN): ) from ex except Exception as ex: - _LOGGER.exception(ex) + _LOGGER.exception("Unexpected exception") raise AbortFlow("unknown_error") from ex finally: diff --git a/homeassistant/components/http/static.py b/homeassistant/components/http/static.py index fd6cd742ce4..b7bb9d4f3a8 100644 --- a/homeassistant/components/http/static.py +++ b/homeassistant/components/http/static.py @@ -58,7 +58,7 @@ class CachingStaticResource(StaticResource): raise except Exception as error: # perm error or other kind! - request.app.logger.exception(error) + request.app.logger.exception("Unexpected exception") raise HTTPNotFound from error content_type: str | None = None diff --git a/homeassistant/components/ipma/config_flow.py b/homeassistant/components/ipma/config_flow.py index 36e70243c93..a0ecf1f582e 100644 --- a/homeassistant/components/ipma/config_flow.py +++ b/homeassistant/components/ipma/config_flow.py @@ -40,8 +40,8 @@ class IpmaFlowHandler(ConfigFlow, domain=DOMAIN): user_input[CONF_LATITUDE], user_input[CONF_LONGITUDE], ) - except IPMAException as err: - _LOGGER.exception(err) + except IPMAException: + _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: return self.async_create_entry(title=location.name, data=user_input) diff --git a/homeassistant/components/jellyfin/config_flow.py b/homeassistant/components/jellyfin/config_flow.py index c6e447d18e8..9a1e3d5985c 100644 --- a/homeassistant/components/jellyfin/config_flow.py +++ b/homeassistant/components/jellyfin/config_flow.py @@ -66,9 +66,9 @@ class JellyfinConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception as ex: # pylint: disable=broad-except + except Exception: # pylint: disable=broad-except errors["base"] = "unknown" - _LOGGER.exception(ex) + _LOGGER.exception("Unexpected exception") else: entry_title = user_input[CONF_URL] @@ -116,9 +116,9 @@ class JellyfinConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception as ex: # pylint: disable=broad-except + except Exception: # pylint: disable=broad-except errors["base"] = "unknown" - _LOGGER.exception(ex) + _LOGGER.exception("Unexpected exception") else: self.hass.config_entries.async_update_entry(self.entry, data=new_input) diff --git a/homeassistant/components/litterrobot/config_flow.py b/homeassistant/components/litterrobot/config_flow.py index 39a1646a8b7..aada2f6c9cb 100644 --- a/homeassistant/components/litterrobot/config_flow.py +++ b/homeassistant/components/litterrobot/config_flow.py @@ -94,7 +94,7 @@ class LitterRobotConfigFlow(ConfigFlow, domain=DOMAIN): return "invalid_auth" except LitterRobotException: return "cannot_connect" - except Exception as ex: # pylint: disable=broad-except - _LOGGER.exception("Unexpected exception: %s", ex) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Unexpected exception") return "unknown" return "" diff --git a/homeassistant/components/logentries/__init__.py b/homeassistant/components/logentries/__init__.py index 6357510a07e..8ddf4a1a543 100644 --- a/homeassistant/components/logentries/__init__.py +++ b/homeassistant/components/logentries/__init__.py @@ -49,8 +49,8 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool: try: payload = {"host": le_wh, "event": json_body} requests.post(le_wh, data=json.dumps(payload), timeout=10) - except requests.exceptions.RequestException as error: - _LOGGER.exception("Error sending to Logentries: %s", error) + except requests.exceptions.RequestException: + _LOGGER.exception("Error sending to Logentries") hass.bus.listen(EVENT_STATE_CHANGED, logentries_event_listener) diff --git a/homeassistant/components/mailgun/notify.py b/homeassistant/components/mailgun/notify.py index ed5b3a69135..39aea79d15e 100644 --- a/homeassistant/components/mailgun/notify.py +++ b/homeassistant/components/mailgun/notify.py @@ -86,8 +86,8 @@ class MailgunNotificationService(BaseNotificationService): except MailgunCredentialsError: _LOGGER.exception("Invalid credentials") return False - except MailgunDomainError as mailgun_error: - _LOGGER.exception(mailgun_error) + except MailgunDomainError: + _LOGGER.exception("Unexpected exception") return False return True @@ -110,5 +110,5 @@ class MailgunNotificationService(BaseNotificationService): files=files, ) _LOGGER.debug("Message sent: %s", resp) - except MailgunError as mailgun_error: - _LOGGER.exception("Failed to send message: %s", mailgun_error) + except MailgunError: + _LOGGER.exception("Failed to send message") diff --git a/homeassistant/components/medcom_ble/config_flow.py b/homeassistant/components/medcom_ble/config_flow.py index faf482ca1f9..a50a5876cc7 100644 --- a/homeassistant/components/medcom_ble/config_flow.py +++ b/homeassistant/components/medcom_ble/config_flow.py @@ -136,11 +136,10 @@ class InspectorBLEConfigFlow(ConfigFlow, domain=DOMAIN): return self.async_abort(reason="cannot_connect") except AbortFlow: raise - except Exception as err: # pylint: disable=broad-except + except Exception: # pylint: disable=broad-except _LOGGER.exception( - "Error occurred reading information from %s: %s", + "Error occurred reading information from %s", self._discovery_info.address, - err, ) return self.async_abort(reason="unknown") _LOGGER.debug("Device connection successful, proceeding") diff --git a/homeassistant/components/minecraft_server/__init__.py b/homeassistant/components/minecraft_server/__init__.py index 5ec737c3f73..0a9eee6a0d5 100644 --- a/homeassistant/components/minecraft_server/__init__.py +++ b/homeassistant/components/minecraft_server/__init__.py @@ -121,10 +121,9 @@ async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> try: await api.async_initialize() - except MinecraftServerAddressError as error: + except MinecraftServerAddressError: _LOGGER.exception( - "Can't migrate configuration entry due to error while parsing server address, try again later: %s", - error, + "Can't migrate configuration entry due to error while parsing server address, try again later" ) return False diff --git a/homeassistant/components/mochad/__init__.py b/homeassistant/components/mochad/__init__.py index 36ebb74edc3..c8714c902a3 100644 --- a/homeassistant/components/mochad/__init__.py +++ b/homeassistant/components/mochad/__init__.py @@ -45,8 +45,8 @@ def setup(hass: HomeAssistant, config: ConfigType) -> bool: try: mochad_controller = MochadCtrl(host, port) - except exceptions.ConfigurationError as err: - _LOGGER.exception(str(err)) + except exceptions.ConfigurationError: + _LOGGER.exception("Unexpected exception") return False def stop_mochad(event): diff --git a/homeassistant/components/msteams/notify.py b/homeassistant/components/msteams/notify.py index d6ebdf3e711..d1118ed7ab5 100644 --- a/homeassistant/components/msteams/notify.py +++ b/homeassistant/components/msteams/notify.py @@ -37,8 +37,8 @@ def get_service( try: return MSTeamsNotificationService(webhook_url) - except RuntimeError as err: - _LOGGER.exception("Error in creating a new Microsoft Teams message: %s", err) + except RuntimeError: + _LOGGER.exception("Error in creating a new Microsoft Teams message") return None diff --git a/homeassistant/components/octoprint/config_flow.py b/homeassistant/components/octoprint/config_flow.py index 6bd592c38bf..0e2fad21871 100644 --- a/homeassistant/components/octoprint/config_flow.py +++ b/homeassistant/components/octoprint/config_flow.py @@ -115,11 +115,11 @@ class OctoPrintConfigFlow(ConfigFlow, domain=DOMAIN): try: await self.api_key_task - except OctoprintException as err: - _LOGGER.exception("Failed to get an application key: %s", err) + except OctoprintException: + _LOGGER.exception("Failed to get an application key") return self.async_show_progress_done(next_step_id="auth_failed") - except Exception as err: # pylint: disable=broad-except - _LOGGER.exception("Failed to get an application key : %s", err) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Failed to get an application key") return self.async_show_progress_done(next_step_id="auth_failed") finally: self.api_key_task = None diff --git a/homeassistant/components/osramlightify/light.py b/homeassistant/components/osramlightify/light.py index 2f0ba1bccb4..50696530e8a 100644 --- a/homeassistant/components/osramlightify/light.py +++ b/homeassistant/components/osramlightify/light.py @@ -83,8 +83,8 @@ def setup_platform( host = config[CONF_HOST] try: bridge = Lightify(host, log_level=logging.NOTSET) - except OSError as err: - _LOGGER.exception("Error connecting to bridge: %s due to: %s", host, err) + except OSError: + _LOGGER.exception("Error connecting to bridge %s", host) return setup_bridge(bridge, add_entities, config) diff --git a/homeassistant/components/panasonic_viera/__init__.py b/homeassistant/components/panasonic_viera/__init__.py index 7d224c7126f..8ec825c5974 100644 --- a/homeassistant/components/panasonic_viera/__init__.py +++ b/homeassistant/components/panasonic_viera/__init__.py @@ -177,8 +177,8 @@ class Remote: self._control = None self.state = STATE_OFF self.available = self._on_action is not None - except Exception as err: # pylint: disable=broad-except - _LOGGER.exception("An unknown error occurred: %s", err) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("An unknown error occurred") self._control = None self.state = STATE_OFF self.available = self._on_action is not None @@ -265,7 +265,7 @@ class Remote: self.state = STATE_OFF self.available = self._on_action is not None await self.async_create_remote_control() - except Exception as err: # pylint: disable=broad-except - _LOGGER.exception("An unknown error occurred: %s", err) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("An unknown error occurred") self.state = STATE_OFF self.available = self._on_action is not None diff --git a/homeassistant/components/panasonic_viera/config_flow.py b/homeassistant/components/panasonic_viera/config_flow.py index c06de119244..65a830c9b1a 100644 --- a/homeassistant/components/panasonic_viera/config_flow.py +++ b/homeassistant/components/panasonic_viera/config_flow.py @@ -60,8 +60,8 @@ class PanasonicVieraConfigFlow(ConfigFlow, domain=DOMAIN): except (URLError, SOAPError, OSError) as err: _LOGGER.error("Could not establish remote connection: %s", err) errors["base"] = "cannot_connect" - except Exception as err: # pylint: disable=broad-except - _LOGGER.exception("An unknown error occurred: %s", err) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("An unknown error occurred") return self.async_abort(reason="unknown") if "base" not in errors: @@ -118,8 +118,8 @@ class PanasonicVieraConfigFlow(ConfigFlow, domain=DOMAIN): except (URLError, OSError) as err: _LOGGER.error("The remote connection was lost: %s", err) return self.async_abort(reason="cannot_connect") - except Exception as err: # pylint: disable=broad-except - _LOGGER.exception("Unknown error: %s", err) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Unknown error") return self.async_abort(reason="unknown") if "base" not in errors: @@ -142,8 +142,8 @@ class PanasonicVieraConfigFlow(ConfigFlow, domain=DOMAIN): except (URLError, SOAPError, OSError) as err: _LOGGER.error("The remote connection was lost: %s", err) return self.async_abort(reason="cannot_connect") - except Exception as err: # pylint: disable=broad-except - _LOGGER.exception("Unknown error: %s", err) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Unknown error") return self.async_abort(reason="unknown") return self.async_show_form( diff --git a/homeassistant/components/permobil/coordinator.py b/homeassistant/components/permobil/coordinator.py index f505e73fa23..6efde26d341 100644 --- a/homeassistant/components/permobil/coordinator.py +++ b/homeassistant/components/permobil/coordinator.py @@ -50,8 +50,7 @@ class MyPermobilCoordinator(DataUpdateCoordinator[MyPermobilData]): except MyPermobilAPIException as err: _LOGGER.exception( - "Error fetching data from MyPermobil API for account %s %s", + "Error fetching data from MyPermobil API for account %s", self.p_api.email, - err, ) raise UpdateFailed from err diff --git a/homeassistant/components/plex/config_flow.py b/homeassistant/components/plex/config_flow.py index 301716e14d5..dabde0b0490 100644 --- a/homeassistant/components/plex/config_flow.py +++ b/homeassistant/components/plex/config_flow.py @@ -216,8 +216,8 @@ class PlexFlowHandler(ConfigFlow, domain=DOMAIN): self.available_servers = available_servers.args[0] return await self.async_step_select_server() - except Exception as error: # pylint: disable=broad-except - _LOGGER.exception("Unknown error connecting to Plex server: %s", error) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Unknown error connecting to Plex server") return self.async_abort(reason="unknown") if errors: diff --git a/homeassistant/components/prosegur/config_flow.py b/homeassistant/components/prosegur/config_flow.py index ca8e4db35cc..36d1ae9d10f 100644 --- a/homeassistant/components/prosegur/config_flow.py +++ b/homeassistant/components/prosegur/config_flow.py @@ -62,8 +62,8 @@ class ProsegurConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "cannot_connect" except InvalidAuth: errors["base"] = "invalid_auth" - except Exception as exception: # pylint: disable=broad-except - _LOGGER.exception(exception) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: self.user_input = user_input diff --git a/homeassistant/components/python_script/__init__.py b/homeassistant/components/python_script/__init__.py index e976ae5d1b0..89e9eb5a9eb 100644 --- a/homeassistant/components/python_script/__init__.py +++ b/homeassistant/components/python_script/__init__.py @@ -290,7 +290,7 @@ def execute(hass, filename, source, data=None, return_response=False): raise HomeAssistantError( f"Error executing script ({type(err).__name__}): {err}" ) from err - logger.exception("Error executing script: %s", err) + logger.exception("Error executing script") return None return restricted_globals["output"] diff --git a/homeassistant/components/recorder/auto_repairs/schema.py b/homeassistant/components/recorder/auto_repairs/schema.py index aa2fc1bb8cb..41be13312d0 100644 --- a/homeassistant/components/recorder/auto_repairs/schema.py +++ b/homeassistant/components/recorder/auto_repairs/schema.py @@ -55,8 +55,8 @@ def validate_table_schema_supports_utf8( schema_errors = _validate_table_schema_supports_utf8( instance, table_object, columns ) - except Exception as exc: # pylint: disable=broad-except - _LOGGER.exception("Error when validating DB schema: %s", exc) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Error when validating DB schema") _log_schema_errors(table_object, schema_errors) return schema_errors @@ -76,8 +76,8 @@ def validate_table_schema_has_correct_collation( schema_errors = _validate_table_schema_has_correct_collation( instance, table_object ) - except Exception as exc: # pylint: disable=broad-except - _LOGGER.exception("Error when validating DB schema: %s", exc) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Error when validating DB schema") _log_schema_errors(table_object, schema_errors) return schema_errors @@ -159,8 +159,8 @@ def validate_db_schema_precision( return schema_errors try: schema_errors = _validate_db_schema_precision(instance, table_object) - except Exception as exc: # pylint: disable=broad-except - _LOGGER.exception("Error when validating DB schema: %s", exc) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Error when validating DB schema") _log_schema_errors(table_object, schema_errors) return schema_errors diff --git a/homeassistant/components/recorder/core.py b/homeassistant/components/recorder/core.py index 0e404ce4da0..3268bae4d49 100644 --- a/homeassistant/components/recorder/core.py +++ b/homeassistant/components/recorder/core.py @@ -898,8 +898,8 @@ class Recorder(threading.Thread): _LOGGER.debug("Processing task: %s", task) try: self._process_one_task_or_event_or_recover(task) - except Exception as err: # pylint: disable=broad-except - _LOGGER.exception("Error while processing event %s: %s", task, err) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Error while processing event %s", task) def _process_one_task_or_event_or_recover(self, task: RecorderTask | Event) -> None: """Process a task or event, reconnect, or recover a malformed database.""" @@ -921,11 +921,9 @@ class Recorder(threading.Thread): except exc.DatabaseError as err: if self._handle_database_error(err): return - _LOGGER.exception( - "Unhandled database error while processing task %s: %s", task, err - ) - except SQLAlchemyError as err: - _LOGGER.exception("SQLAlchemyError error processing task %s: %s", task, err) + _LOGGER.exception("Unhandled database error while processing task %s", task) + except SQLAlchemyError: + _LOGGER.exception("SQLAlchemyError error processing task %s", task) # Reset the session if an SQLAlchemyError (including DatabaseError) # happens to rollback and recover @@ -941,10 +939,9 @@ class Recorder(threading.Thread): return migration.initialize_database(self.get_session) except UnsupportedDialect: break - except Exception as err: # pylint: disable=broad-except + except Exception: # pylint: disable=broad-except _LOGGER.exception( - "Error during connection setup: %s (retrying in %s seconds)", - err, + "Error during connection setup: (retrying in %s seconds)", self.db_retry_wait, ) tries += 1 @@ -1262,10 +1259,8 @@ class Recorder(threading.Thread): try: self.event_session.rollback() self.event_session.close() - except SQLAlchemyError as err: - _LOGGER.exception( - "Error while rolling back and closing the event session: %s", err - ) + except SQLAlchemyError: + _LOGGER.exception("Error while rolling back and closing the event session") def _reopen_event_session(self) -> None: """Rollback the event session and reopen it after a failure.""" @@ -1473,8 +1468,8 @@ class Recorder(threading.Thread): self.recorder_runs_manager.end(self.event_session) try: self._commit_event_session_or_retry() - except Exception as err: # pylint: disable=broad-except - _LOGGER.exception("Error saving the event session during shutdown: %s", err) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Error saving the event session during shutdown") self.event_session.close() self.recorder_runs_manager.clear() diff --git a/homeassistant/components/recorder/migration.py b/homeassistant/components/recorder/migration.py index fc2e6ec2b3f..0d882ed3b66 100644 --- a/homeassistant/components/recorder/migration.py +++ b/homeassistant/components/recorder/migration.py @@ -183,8 +183,8 @@ def get_schema_version(session_maker: Callable[[], Session]) -> int | None: try: with session_scope(session=session_maker(), read_only=True) as session: return _get_schema_version(session) - except Exception as err: # pylint: disable=broad-except - _LOGGER.exception("Error when determining DB schema version: %s", err) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Error when determining DB schema version") return None @@ -1786,8 +1786,8 @@ def initialize_database(session_maker: Callable[[], Session]) -> bool: with session_scope(session=session_maker()) as session: return _initialize_database(session) - except Exception as err: # pylint: disable=broad-except - _LOGGER.exception("Error when initialise database: %s", err) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Error when initialise database") return False diff --git a/homeassistant/components/recorder/models/context.py b/homeassistant/components/recorder/models/context.py index c09ee366b84..0d81bab879a 100644 --- a/homeassistant/components/recorder/models/context.py +++ b/homeassistant/components/recorder/models/context.py @@ -18,8 +18,8 @@ def ulid_to_bytes_or_none(ulid: str | None) -> bytes | None: return None try: return ulid_to_bytes(ulid) - except ValueError as ex: - _LOGGER.exception("Error converting ulid %s to bytes: %s", ulid, ex) + except ValueError: + _LOGGER.exception("Error converting ulid %s to bytes", ulid) return None @@ -29,8 +29,8 @@ def bytes_to_ulid_or_none(_bytes: bytes | None) -> str | None: return None try: return bytes_to_ulid(_bytes) - except ValueError as ex: - _LOGGER.exception("Error converting bytes %s to ulid: %s", _bytes, ex) + except ValueError: + _LOGGER.exception("Error converting bytes %s to ulid", _bytes) return None diff --git a/homeassistant/components/recorder/util.py b/homeassistant/components/recorder/util.py index 770dc91353c..77467ec1171 100644 --- a/homeassistant/components/recorder/util.py +++ b/homeassistant/components/recorder/util.py @@ -143,7 +143,7 @@ def session_scope( need_rollback = True session.commit() except Exception as err: # pylint: disable=broad-except - _LOGGER.exception("Error executing query: %s", err) + _LOGGER.exception("Error executing query") if need_rollback: session.rollback() if not exception_filter or not exception_filter(err): diff --git a/homeassistant/components/reolink/host.py b/homeassistant/components/reolink/host.py index 73e6ddd6115..4f5487a6a04 100644 --- a/homeassistant/components/reolink/host.py +++ b/homeassistant/components/reolink/host.py @@ -547,9 +547,9 @@ class ReolinkHost: self._long_poll_error = True await asyncio.sleep(LONG_POLL_ERROR_COOLDOWN) continue - except Exception as ex: + except Exception: _LOGGER.exception( - "Unexpected exception while requesting ONVIF pull point: %s", ex + "Unexpected exception while requesting ONVIF pull point" ) await self._api.unsubscribe(sub_type=SubType.long_poll) raise @@ -652,11 +652,9 @@ class ReolinkHost: message = data.decode("utf-8") channels = await self._api.ONVIF_event_callback(message) - except Exception as ex: # pylint: disable=broad-except + except Exception: # pylint: disable=broad-except _LOGGER.exception( - "Error processing ONVIF event for Reolink %s: %s", - self._api.nvr_name, - ex, + "Error processing ONVIF event for Reolink %s", self._api.nvr_name ) return diff --git a/homeassistant/components/rest/switch.py b/homeassistant/components/rest/switch.py index f0da6366cfc..99aadce6620 100644 --- a/homeassistant/components/rest/switch.py +++ b/homeassistant/components/rest/switch.py @@ -219,8 +219,8 @@ class RestSwitch(ManualTriggerEntity, SwitchEntity): req = await self.get_device_state(self.hass) except (TimeoutError, httpx.TimeoutException): _LOGGER.exception("Timed out while fetching data") - except httpx.RequestError as err: - _LOGGER.exception("Error while fetching data: %s", err) + except httpx.RequestError: + _LOGGER.exception("Error while fetching data") if req: self._process_manual_data(req.text) diff --git a/homeassistant/components/roborock/config_flow.py b/homeassistant/components/roborock/config_flow.py index ede9afc826d..5715aba3bba 100644 --- a/homeassistant/components/roborock/config_flow.py +++ b/homeassistant/components/roborock/config_flow.py @@ -69,11 +69,11 @@ class RoborockFlowHandler(ConfigFlow, domain=DOMAIN): errors["base"] = "unknown_url" except RoborockInvalidEmail: errors["base"] = "invalid_email_format" - except RoborockException as ex: - _LOGGER.exception(ex) + except RoborockException: + _LOGGER.exception("Unexpected exception") errors["base"] = "unknown_roborock" - except Exception as ex: # pylint: disable=broad-except - _LOGGER.exception(ex) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" return errors @@ -92,11 +92,11 @@ class RoborockFlowHandler(ConfigFlow, domain=DOMAIN): login_data = await self._client.code_login(code) except RoborockInvalidCode: errors["base"] = "invalid_code" - except RoborockException as ex: - _LOGGER.exception(ex) + except RoborockException: + _LOGGER.exception("Unexpected exception") errors["base"] = "unknown_roborock" - except Exception as ex: # pylint: disable=broad-except - _LOGGER.exception(ex) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: if self.reauth_entry is not None: diff --git a/homeassistant/components/serial/sensor.py b/homeassistant/components/serial/sensor.py index 7f40279df85..5f2b1ea3c3c 100644 --- a/homeassistant/components/serial/sensor.py +++ b/homeassistant/components/serial/sensor.py @@ -187,12 +187,10 @@ class SerialSensor(SensorEntity): **kwargs, ) - except SerialException as exc: + except SerialException: if not logged_error: _LOGGER.exception( - "Unable to connect to the serial device %s: %s. Will retry", - device, - exc, + "Unable to connect to the serial device %s. Will retry", device ) logged_error = True await self._handle_error() @@ -201,9 +199,9 @@ class SerialSensor(SensorEntity): while True: try: line = await reader.readline() - except SerialException as exc: + except SerialException: _LOGGER.exception( - "Error while reading serial device %s: %s", device, exc + "Error while reading serial device %s", device ) await self._handle_error() break diff --git a/homeassistant/components/shell_command/__init__.py b/homeassistant/components/shell_command/__init__.py index 91cb48e9988..736654fc399 100644 --- a/homeassistant/components/shell_command/__init__.py +++ b/homeassistant/components/shell_command/__init__.py @@ -58,8 +58,8 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: rendered_args = args_compiled.async_render( variables=service.data, parse_result=False ) - except TemplateError as ex: - _LOGGER.exception("Error rendering command template: %s", ex) + except TemplateError: + _LOGGER.exception("Error rendering command template") raise else: rendered_args = None diff --git a/homeassistant/components/sia/config_flow.py b/homeassistant/components/sia/config_flow.py index f7a7a1f06e4..4329154b069 100644 --- a/homeassistant/components/sia/config_flow.py +++ b/homeassistant/components/sia/config_flow.py @@ -77,8 +77,8 @@ def validate_input(data: dict[str, Any]) -> dict[str, str] | None: return {"base": "invalid_account_format"} except InvalidAccountLengthError: return {"base": "invalid_account_length"} - except Exception as exc: # pylint: disable=broad-except - _LOGGER.exception("Unexpected exception from SIAAccount: %s", exc) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Unexpected exception from SIAAccount") return {"base": "unknown"} if not 1 <= data[CONF_PING_INTERVAL] <= 1440: return {"base": "invalid_ping"} diff --git a/homeassistant/components/slack/config_flow.py b/homeassistant/components/slack/config_flow.py index b23dc60da60..03f3683e5a9 100644 --- a/homeassistant/components/slack/config_flow.py +++ b/homeassistant/components/slack/config_flow.py @@ -68,7 +68,7 @@ class SlackFlowHandler(ConfigFlow, domain=DOMAIN): if ex.response["error"] == "invalid_auth": return "invalid_auth", None return "cannot_connect", None - except Exception as ex: # pylint:disable=broad-except - _LOGGER.exception("Unexpected exception: %s", ex) + except Exception: # pylint:disable=broad-except + _LOGGER.exception("Unexpected exception") return "unknown", None return None, info diff --git a/homeassistant/components/tesla_wall_connector/config_flow.py b/homeassistant/components/tesla_wall_connector/config_flow.py index b00dd8f2b9d..44848cb1dfe 100644 --- a/homeassistant/components/tesla_wall_connector/config_flow.py +++ b/homeassistant/components/tesla_wall_connector/config_flow.py @@ -104,8 +104,8 @@ class TeslaWallConnectorConfigFlow(ConfigFlow, domain=DOMAIN): info = await validate_input(self.hass, user_input) except WallConnectorError: errors["base"] = "cannot_connect" - except Exception as ex: # pylint: disable=broad-except - _LOGGER.exception("Unexpected exception: %s", ex) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" if not errors: diff --git a/homeassistant/components/unifiprotect/__init__.py b/homeassistant/components/unifiprotect/__init__.py index 71c887cd870..5943cc4f85e 100644 --- a/homeassistant/components/unifiprotect/__init__.py +++ b/homeassistant/components/unifiprotect/__init__.py @@ -154,7 +154,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: }, ) ir.async_delete_issue(hass, DOMAIN, "ea_channel_warning") - _LOGGER.exception("Error setting up UniFi Protect integration: %s", err) + _LOGGER.exception("Error setting up UniFi Protect integration") raise return True diff --git a/homeassistant/components/waqi/config_flow.py b/homeassistant/components/waqi/config_flow.py index 068cb1a5020..e7e7a536654 100644 --- a/homeassistant/components/waqi/config_flow.py +++ b/homeassistant/components/waqi/config_flow.py @@ -45,8 +45,8 @@ async def get_by_station_number( measuring_station = await client.get_by_station_number(station_number) except WAQIConnectionError: errors["base"] = "cannot_connect" - except Exception as exc: # pylint: disable=broad-except - _LOGGER.exception(exc) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" return measuring_station, errors @@ -76,8 +76,8 @@ class WAQIConfigFlow(ConfigFlow, domain=DOMAIN): errors["base"] = "invalid_auth" except WAQIConnectionError: errors["base"] = "cannot_connect" - except Exception as exc: # pylint: disable=broad-except - _LOGGER.exception(exc) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: self.data = user_input @@ -118,8 +118,8 @@ class WAQIConfigFlow(ConfigFlow, domain=DOMAIN): ) except WAQIConnectionError: errors["base"] = "cannot_connect" - except Exception as exc: # pylint: disable=broad-except - _LOGGER.exception(exc) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Unexpected exception") errors["base"] = "unknown" else: return await self._async_create_entry(measuring_station) diff --git a/homeassistant/components/websocket_api/commands.py b/homeassistant/components/websocket_api/commands.py index 191ea1ea996..11210fcfcbc 100644 --- a/homeassistant/components/websocket_api/commands.py +++ b/homeassistant/components/websocket_api/commands.py @@ -289,7 +289,7 @@ async def handle_call_service( translation_placeholders=err.translation_placeholders, ) except HomeAssistantError as err: - connection.logger.exception(err) + connection.logger.exception("Unexpected exception") connection.send_error( msg["id"], const.ERR_HOME_ASSISTANT_ERROR, @@ -299,7 +299,7 @@ async def handle_call_service( translation_placeholders=err.translation_placeholders, ) except Exception as err: # pylint: disable=broad-except - connection.logger.exception(err) + connection.logger.exception("Unexpected exception") connection.send_error(msg["id"], const.ERR_UNKNOWN_ERROR, str(err)) diff --git a/homeassistant/components/wemo/wemo_device.py b/homeassistant/components/wemo/wemo_device.py index 2a4185a7640..148646736bc 100644 --- a/homeassistant/components/wemo/wemo_device.py +++ b/homeassistant/components/wemo/wemo_device.py @@ -205,7 +205,7 @@ class DeviceCoordinator(DataUpdateCoordinator[None]): # pylint: disable=hass-en except Exception as err: # pylint: disable=broad-except self.last_exception = err self.last_update_success = False - _LOGGER.exception("Unexpected error fetching %s data: %s", self.name, err) + _LOGGER.exception("Unexpected error fetching %s data", self.name) else: self.async_set_updated_data(None) diff --git a/homeassistant/components/wyoming/stt.py b/homeassistant/components/wyoming/stt.py index 227fa3a0eca..a28e5fdb527 100644 --- a/homeassistant/components/wyoming/stt.py +++ b/homeassistant/components/wyoming/stt.py @@ -126,8 +126,8 @@ class WyomingSttProvider(stt.SpeechToTextEntity): text = transcript.text break - except (OSError, WyomingError) as err: - _LOGGER.exception("Error processing audio stream: %s", err) + except (OSError, WyomingError): + _LOGGER.exception("Error processing audio stream") return stt.SpeechResult(None, stt.SpeechResultState.ERROR) return stt.SpeechResult( diff --git a/homeassistant/components/wyoming/wake_word.py b/homeassistant/components/wyoming/wake_word.py index 303a87e99bd..6eba0f7ca6d 100644 --- a/homeassistant/components/wyoming/wake_word.py +++ b/homeassistant/components/wyoming/wake_word.py @@ -187,8 +187,8 @@ class WyomingWakeWordProvider(wake_word.WakeWordDetectionEntity): for task in pending: task.cancel() - except (OSError, WyomingError) as err: - _LOGGER.exception("Error processing audio stream: %s", err) + except (OSError, WyomingError): + _LOGGER.exception("Error processing audio stream") return None diff --git a/homeassistant/core.py b/homeassistant/core.py index 3b52b020957..76a3f55527c 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -1101,10 +1101,8 @@ class HomeAssistant: _LOGGER.exception( "Task %s could not be canceled during final shutdown stage", task ) - except Exception as exc: # pylint: disable=broad-except - _LOGGER.exception( - "Task %s error during final shutdown stage: %s", task, exc - ) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Task %s error during final shutdown stage", task) # Prevent run_callback_threadsafe from scheduling any additional # callbacks in the event loop as callbacks created on the futures diff --git a/homeassistant/data_entry_flow.py b/homeassistant/data_entry_flow.py index 6a1453c9ff3..649c9fdf8a4 100644 --- a/homeassistant/data_entry_flow.py +++ b/homeassistant/data_entry_flow.py @@ -489,8 +489,8 @@ class FlowManager(abc.ABC, Generic[_FlowResultT, _HandlerT]): flow.async_cancel_progress_task() try: flow.async_remove() - except Exception as err: # pylint: disable=broad-except - _LOGGER.exception("Error removing %s flow: %s", flow.handler, err) + except Exception: # pylint: disable=broad-except + _LOGGER.exception("Error removing %s flow", flow.handler) async def _async_handle_step( self, diff --git a/homeassistant/helpers/update_coordinator.py b/homeassistant/helpers/update_coordinator.py index c52be9982c5..0d7365c25bd 100644 --- a/homeassistant/helpers/update_coordinator.py +++ b/homeassistant/helpers/update_coordinator.py @@ -383,9 +383,7 @@ class DataUpdateCoordinator(BaseDataUpdateCoordinatorProtocol, Generic[_DataT]): except Exception as err: # pylint: disable=broad-except self.last_exception = err self.last_update_success = False - self.logger.exception( - "Unexpected error fetching %s data: %s", self.name, err - ) + self.logger.exception("Unexpected error fetching %s data", self.name) else: if not self.last_update_success: diff --git a/pyproject.toml b/pyproject.toml index 062b8aaf77a..891ea511ba5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -715,8 +715,7 @@ ignore = [ "PT019", "TRY002", "TRY301", - "TRY300", - "TRY401" + "TRY300" ] [tool.ruff.lint.flake8-import-conventions.extend-aliases] diff --git a/tests/components/python_script/test_init.py b/tests/components/python_script/test_init.py index bec94db71f9..8e317e2163e 100644 --- a/tests/components/python_script/test_init.py +++ b/tests/components/python_script/test_init.py @@ -143,7 +143,7 @@ raise Exception('boom') hass.async_add_executor_job(execute, hass, "test.py", source, {}) await hass.async_block_till_done() - assert "Error executing script: boom" in caplog.text + assert "Error executing script" in caplog.text async def test_execute_runtime_error_with_response(hass: HomeAssistant) -> None: diff --git a/tests/test_data_entry_flow.py b/tests/test_data_entry_flow.py index 5c3ad2a3b39..c8c6b21951d 100644 --- a/tests/test_data_entry_flow.py +++ b/tests/test_data_entry_flow.py @@ -189,7 +189,7 @@ async def test_abort_calls_async_remove_with_exception( with caplog.at_level(logging.ERROR): await manager.async_init("test") - assert "Error removing test flow: error" in caplog.text + assert "Error removing test flow" in caplog.text TestFlow.async_remove.assert_called_once()