Fix logging of cross-wiki API errors

Error messages included a non-existent 'code' parameter; use the
curl error message instead. Also log the error status (which is
there somewhere in 'response' but logstash doesn't manipulate JSON
fields well).

Bug: T328128
Change-Id: If295d7a3b397b22301986a226a54df908c2ccf4d
This commit is contained in:
Gergő Tisza 2023-03-19 16:48:10 -07:00
parent 5f373567c5
commit 79ee292ca4
No known key found for this signature in database
GPG key ID: C34FEC97E6257F96

View file

@ -245,9 +245,11 @@ class EchoForeignWikiRequest {
if ( !isset( $results[$wiki] ) ) {
LoggerFactory::getInstance( 'Echo' )->warning(
'Failed to fetch API response from {wiki}. Error code {code}',
'Failed to fetch API response from {wiki}. Error: {error}',
[
'wiki' => $wiki,
'error' => $response['response']['error'] ?? 'unknown',
'statusCode' => $statusCode,
'response' => $response['response'],
'request' => $reqs[$wiki],
]