Skip to content

Commit

Permalink
Merge pull request #297 from magento-gl/ACQE-5022-handle-internal-exc…
Browse files Browse the repository at this point in the history
…eption

Fix internal exception in codeception
  • Loading branch information
KevinBKozan authored May 31, 2023
2 parents bc5eae1 + 1822fb1 commit 222f751
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,12 @@ public function attachExceptionToAllure($exception, $testMethod)

AllureHelper::addAttachmentToCurrentStep($exception, $context . 'Exception');

//pop suppressed exceptions and attach to allure
$change = function () {
if ($this instanceof \PHPUnit\Framework\ExceptionWrapper) {
return $this->previous;
} else {
return $this->getPrevious();
}
};
$previousException = $change->call($exception);
$previousException = null;
if ($exception instanceof \PHPUnit\Framework\ExceptionWrapper) {
$previousException = $exception->getPreviousWrapped();
} elseif ($exception instanceof \Throwable) {
$previousException = $exception->getPrevious();
}

if ($previousException !== null) {
$this->attachExceptionToAllure($previousException, $testMethod);
Expand Down

0 comments on commit 222f751

Please sign in to comment.