From 7abe9487a0394314b14526aa517163995704c60b Mon Sep 17 00:00:00 2001 From: Vedant Bhamare <55763604+Dark-Knight11@users.noreply.github.com> Date: Wed, 6 Oct 2021 23:33:48 +0530 Subject: [PATCH] Use new format for logging exceptions - resolution/module.py (#3207) --- supervisor/resolution/module.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/supervisor/resolution/module.py b/supervisor/resolution/module.py index 0a6fc2dff..a078786b7 100644 --- a/supervisor/resolution/module.py +++ b/supervisor/resolution/module.py @@ -176,8 +176,9 @@ class ResolutionManager(FileConfiguration, CoreSysAttributes): async def apply_suggestion(self, suggestion: Suggestion) -> None: """Apply suggested action.""" if suggestion not in self._suggestions: - _LOGGER.warning("Suggestion %s is not valid", suggestion.uuid) - raise ResolutionError() + raise ResolutionError( + f"Suggestion {suggestion.uuid} is not valid", _LOGGER.warning + ) await self.fixup.apply_fixup(suggestion) await self.healthcheck() @@ -185,20 +186,21 @@ class ResolutionManager(FileConfiguration, CoreSysAttributes): def dismiss_suggestion(self, suggestion: Suggestion) -> None: """Dismiss suggested action.""" if suggestion not in self._suggestions: - _LOGGER.warning("The UUID %s is not valid suggestion", suggestion.uuid) - raise ResolutionError() + raise ResolutionError( + f"The UUID {suggestion.uuid} is not valid suggestion", _LOGGER.warning + ) self._suggestions.remove(suggestion) def dismiss_issue(self, issue: Issue) -> None: """Dismiss suggested action.""" if issue not in self._issues: - _LOGGER.warning("The UUID %s is not a valid issue", issue.uuid) - raise ResolutionError() + raise ResolutionError( + f"The UUID {issue.uuid} is not a valid issue", _LOGGER.warning + ) self._issues.remove(issue) def dismiss_unsupported(self, reason: Issue) -> None: """Dismiss a reason for unsupported.""" if reason not in self._unsupported: - _LOGGER.warning("The reason %s is not active", reason) - raise ResolutionError() + raise ResolutionError(f"The reason {reason} is not active", _LOGGER.warning) self._unsupported.remove(reason)