mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-30 17:14:42 +00:00
ApiVisualEditor: Add logging for RESTBase HTTP errors
Bug: T233127 Change-Id: Ide5138d8f8f462b9c3d7da10f26ff57c9d17f1c9
This commit is contained in:
parent
9dc3ecf4e4
commit
9ce8ae05c7
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
use MediaWiki\Block\DatabaseBlock;
|
use MediaWiki\Block\DatabaseBlock;
|
||||||
use MediaWiki\MediaWikiServices;
|
use MediaWiki\MediaWikiServices;
|
||||||
|
use MediaWiki\Logger\LoggerFactory;
|
||||||
|
|
||||||
class ApiVisualEditor extends ApiBase {
|
class ApiVisualEditor extends ApiBase {
|
||||||
|
|
||||||
|
@ -25,6 +26,11 @@ class ApiVisualEditor extends ApiBase {
|
||||||
*/
|
*/
|
||||||
protected $serviceClient;
|
protected $serviceClient;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Psr\Log\LoggerInterface
|
||||||
|
*/
|
||||||
|
protected $logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
|
@ -32,6 +38,7 @@ class ApiVisualEditor extends ApiBase {
|
||||||
parent::__construct( $main, $name );
|
parent::__construct( $main, $name );
|
||||||
$this->veConfig = $config;
|
$this->veConfig = $config;
|
||||||
$this->serviceClient = new VirtualRESTServiceClient( new MultiHttpClient( [] ) );
|
$this->serviceClient = new VirtualRESTServiceClient( new MultiHttpClient( [] ) );
|
||||||
|
$this->logger = LoggerFactory::getInstance( 'VisualEditor' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -127,6 +134,17 @@ class ApiVisualEditor extends ApiBase {
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// error null, code not 200
|
// error null, code not 200
|
||||||
|
$this->logger->warning(
|
||||||
|
__METHOD__ . ": Received HTTP {code} from RESTBase",
|
||||||
|
[
|
||||||
|
'code' => $response['code'],
|
||||||
|
'trace' => ( new Exception )->getTraceAsString(),
|
||||||
|
'response' => $response['body'],
|
||||||
|
'requestPath' => $path,
|
||||||
|
/** @phan-suppress-next-line PhanTypeInvalidDimOffset */
|
||||||
|
'requestIfMatch' => $reqheaders['If-Match'] ?? '',
|
||||||
|
]
|
||||||
|
);
|
||||||
$this->dieWithError(
|
$this->dieWithError(
|
||||||
[ 'apierror-visualeditor-docserver-http', $response['code'] ],
|
[ 'apierror-visualeditor-docserver-http', $response['code'] ],
|
||||||
'apierror-visualeditor-docserver-http'
|
'apierror-visualeditor-docserver-http'
|
||||||
|
|
Loading…
Reference in a new issue