mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-27 15:50:29 +00:00
ApiParsoidTrait: Fix MediaWiki\Rest\HttpException handling
Don't use RawMessage, the API error formatter doesn't know what to do with it. Instead call dieWithException(). These exceptions probably shouldn't bubble up here, but we can worry about that later. Bug: T344173 Change-Id: I3d1645a3580feeed6fe1431a7bfcdc584f681061
This commit is contained in:
parent
ca64e7e407
commit
fcc6decd57
|
@ -22,7 +22,7 @@ use NullStatsdDataFactory;
|
|||
use PrefixingStatsdDataFactoryProxy;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\NullLogger;
|
||||
use RawMessage;
|
||||
use Throwable;
|
||||
use Title;
|
||||
use WebRequest;
|
||||
|
||||
|
@ -84,7 +84,7 @@ trait ApiParsoidTrait {
|
|||
if ( $ex instanceof LocalizedHttpException ) {
|
||||
$msg = $ex->getMessageValue();
|
||||
} else {
|
||||
$msg = new RawMessage( $ex->getMessage() );
|
||||
$this->dieWithException( $ex );
|
||||
}
|
||||
|
||||
$this->dieWithError( [
|
||||
|
@ -212,6 +212,14 @@ trait ApiParsoidTrait {
|
|||
*/
|
||||
abstract public function dieWithError( $msg, $code = null, $data = null, $httpCode = null );
|
||||
|
||||
/**
|
||||
* @see ApiBase
|
||||
* @param Throwable $exception See ApiErrorFormatter::getMessageFromException()
|
||||
* @param array $options See ApiErrorFormatter::getMessageFromException()
|
||||
* @return never
|
||||
*/
|
||||
abstract public function dieWithException( Throwable $exception, array $options = [] );
|
||||
|
||||
/**
|
||||
* @see ContextSource
|
||||
* @return WebRequest
|
||||
|
|
Loading…
Reference in a new issue