Skip to content

Commit 482aa62

Browse files
committed
Add more error information
1 parent 0fdfadc commit 482aa62

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

custom_components/stromer/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
"iot_class": "cloud_polling",
99
"issue_tracker": "https://github.com/CoMPaTech/stromer/issues",
1010
"requirements": [],
11-
"version": "0.4.3a2"
11+
"version": "0.4.3a3"
1212
}

custom_components/stromer/stromer.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,18 @@ async def stromer_get_code(self) -> None:
170170
url, data=data, headers={"Referer": url}, allow_redirects=False
171171
)
172172
next_loc = res.headers.get("Location")
173+
if not next_loc:
174+
LOGGER.error("No next location returned from Stromer API. Full response details:")
175+
LOGGER.error(" **DONT DOX BY SHARING** Full Request-Data: %s", data)
176+
LOGGER.error(" **SHARE RESPONSIBLY ** Full Partial-Data: %s", data["next"])
177+
LOGGER.error(" Status: %s", res.status)
178+
LOGGER.error(" Headers: %s", dict(res.headers))
179+
try:
180+
body_text = await res.text()
181+
LOGGER.error(" Body: %s", body_text)
182+
except Exception as err:
183+
raise NextLocationError("Unable to provide body information from Stromer API") from err
184+
raise NextLocationError("No next location returned from Stromer API") from None
173185

174186
next_url = f"{self.base_url}{next_loc}"
175187
if not (next_loc.startswith("/") or next_loc.startswith("?")):

0 commit comments

Comments
 (0)