Add response body detail to login error messages for debugging

https://claude.ai/code/session_01UsuvFAmmeagtQa14QA4iaq
This commit is contained in:
Claude 2026-04-22 05:31:04 +00:00
parent 78a2b41329
commit dbce0299d6
No known key found for this signature in database

View file

@ -61,7 +61,9 @@ class UniFiController {
curl_close($ch); curl_close($ch);
if ($httpCode !== 200) { if ($httpCode !== 200) {
throw new Exception("Login fehlgeschlagen: HTTP $httpCode"); $body = json_decode($response, true);
$detail = $body['meta']['msg'] ?? $body['errors'][0] ?? substr(strip_tags($response), 0, 120);
throw new Exception("Login fehlgeschlagen: HTTP $httpCode" . ($detail ? " $detail" : ''));
} }
$data = json_decode($response, true); $data = json_decode($response, true);