Skip to content

Commit 71391c3

Browse files
Copilotkylegordon
andcommitted
Improve error logging with full exception details and traceback
Co-authored-by: kylegordon <231528+kylegordon@users.noreply.github.com>
1 parent d922ebd commit 71391c3

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

custom_components/pettracer/__init__.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
3737
_LOGGER.error("Failed to authenticate with PetTracer: %s", err)
3838
raise ConfigEntryAuthFailed from err
3939
except Exception as err:
40-
_LOGGER.error("Unexpected error during PetTracer authentication: %s", err)
40+
_LOGGER.error(
41+
"Unexpected error during PetTracer authentication: %s",
42+
err,
43+
exc_info=True
44+
)
4145
raise ConfigEntryNotReady from err
4246

4347
# Create update coordinator
@@ -85,6 +89,20 @@ async def _async_update_data(self):
8589
devices = await self.client.get_all_devices()
8690
return {"devices": devices}
8791
except PetTracerError as err:
92+
_LOGGER.error(
93+
"Error communicating with PetTracer API: %s",
94+
err,
95+
exc_info=True
96+
)
8897
raise UpdateFailed(
8998
f"Error communicating with PetTracer API: {err}"
9099
) from err
100+
except Exception as err:
101+
_LOGGER.error(
102+
"Unexpected error fetching PetTracer data: %s",
103+
err,
104+
exc_info=True
105+
)
106+
raise UpdateFailed(
107+
f"Unexpected error fetching PetTracer data: {err}"
108+
) from err

0 commit comments

Comments
 (0)