Skip to content

Commit 60154a4

Browse files
author
Oleksii Korshenko
committed
MAGETWO-49586: [GitHub] Fix Web API error masking in production mode #2371
1 parent ee6f28d commit 60154a4

File tree

4 files changed

+11
-47
lines changed

4 files changed

+11
-47
lines changed

lib/internal/Magento/Framework/Reflection/TypeProcessor.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -421,12 +421,6 @@ public function isArrayType($type)
421421

422422
/**
423423
* Get item type of the array.
424-
* Example:
425-
* <pre>
426-
* ComplexType[] => ComplexType
427-
* string[] => string
428-
* int[] => integer
429-
* </pre>
430424
*
431425
* @param string $arrayType
432426
* @return string

lib/internal/Magento/Framework/Webapi/ErrorProcessor.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,10 @@ public function renderException(\Exception $exception, $httpCode = self::DEFAULT
190190
protected function _critical(\Exception $exception)
191191
{
192192
$reportId = uniqid("webapi-");
193-
194-
$this->_logger->critical(new WebapiException\WebapiExceptionReport($reportId, $exception));
195-
193+
$message = "Report ID: {$reportId}; Message: {$exception->getMessage()}";
194+
$code = $exception->getCode();
195+
$exception = new \Exception($message, $code, $exception);
196+
$this->_logger->critical($exception);
196197
return $reportId;
197198
}
198199

lib/internal/Magento/Framework/Webapi/Exception/WebapiExceptionReport.php

Lines changed: 0 additions & 34 deletions
This file was deleted.

lib/internal/Magento/Framework/Webapi/Test/Unit/ErrorProcessorTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,13 @@ public function testCriticalExceptionStackTrace()
234234

235235
$this->_loggerMock->expects($this->once())
236236
->method('critical')
237-
->will($this->returnCallback(function(\Exception $loggedException) use($thrownException) {
238-
$this->assertSame($thrownException, $loggedException->getPrevious());
239-
}));
240-
237+
->will(
238+
$this->returnCallback(
239+
function (\Exception $loggedException) use ($thrownException) {
240+
$this->assertSame($thrownException, $loggedException->getPrevious());
241+
}
242+
)
243+
);
241244
$this->_errorProcessor->maskException($thrownException);
242245
}
243246

0 commit comments

Comments
 (0)