From 678990cc1ecf18293ceac48e11ef3f5108033598 Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 27 Feb 2024 18:58:31 +0100 Subject: [PATCH] Preserve more error details coming from parsoid. HtmlOutputRendererHelper will throw HttpErrors when parsoid reports an error. We catch these in ApiParsoidTrait, and convert them to action API error responses. When doing so, we should preserve the additional error data included in the HttpError. Bug: T356157 Change-Id: I8c89468c59314069025537e6807ccbc46dbe13c6 --- includes/ApiParsoidTrait.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/ApiParsoidTrait.php b/includes/ApiParsoidTrait.php index eb242621a7..58f54e5266 100644 --- a/includes/ApiParsoidTrait.php +++ b/includes/ApiParsoidTrait.php @@ -84,9 +84,9 @@ trait ApiParsoidTrait { if ( $ex instanceof LocalizedHttpException ) { $converter = new \MediaWiki\Message\Converter(); $msg = $converter->convertMessageValue( $ex->getMessageValue() ); - $this->dieWithError( $msg ); + $this->dieWithError( $msg, null, $ex->getErrorData() ); } else { - $this->dieWithException( $ex ); + $this->dieWithException( $ex, [ 'data' => $ex->getErrorData() ] ); } }