Add response body detail to login error messages for debugging
https://claude.ai/code/session_01UsuvFAmmeagtQa14QA4iaq
This commit is contained in:
parent
78a2b41329
commit
dbce0299d6
1 changed files with 3 additions and 1 deletions
|
|
@ -61,7 +61,9 @@ class UniFiController {
|
|||
curl_close($ch);
|
||||
|
||||
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue