Skip to content

Commit

Permalink
Use traceback instead of raising
Browse files Browse the repository at this point in the history
  • Loading branch information
OnFreund committed Apr 8, 2024
1 parent 519733a commit 720e6c3
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions homeassistant/components/risco/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from dataclasses import dataclass, field
from datetime import timedelta
import logging
import traceback
from typing import Any

from pyrisco import (
Expand Down Expand Up @@ -96,11 +97,8 @@ async def _async_setup_local_entry(hass: HomeAssistant, entry: ConfigEntry) -> b
return False

async def _error(error: Exception) -> None:
try:
raise error
except Exception: # pylint: disable=broad-exception-caught
# This is an exception object we're purposely raising
_LOGGER.exception("Error in Risco library")
tb = traceback.format_exception(error)
_LOGGER.error("Error in Risco library:\n %s", "".join(tb))

entry.async_on_unload(risco.add_error_handler(_error))

Expand Down

0 comments on commit 720e6c3

Please sign in to comment.