diff --git a/core/modules/media/src/Controller/OEmbedIframeController.php b/core/modules/media/src/Controller/OEmbedIframeController.php index 2a6c0eb8fa..3d04c139fc 100644 --- a/core/modules/media/src/Controller/OEmbedIframeController.php +++ b/core/modules/media/src/Controller/OEmbedIframeController.php @@ -183,9 +183,17 @@ public function render(Request $request) { // The oEmbed system makes heavy use of exception wrapping, so log the // entire exception chain to help with troubleshooting. do { - // @todo Log additional information from ResourceException, to help with - // debugging, in https://www.drupal.org/project/drupal/issues/2972846. - $this->logger->error($e->getMessage()); + $message = $e->getMessage(); + $context = []; + if ($e->getUrl()) { + $message .= ' URL: {url}.'; + $context['url'] = $e->getUrl(); + } + if ($e->getData()) { + $message .= ' Data:
{data}
'; + $context['data'] = var_export($e->getData(), TRUE); + } + $this->logger->error($message, $context); $e = $e->getPrevious(); } while ($e); } diff --git a/core/modules/media/src/OEmbed/ProviderRepository.php b/core/modules/media/src/OEmbed/ProviderRepository.php index 8b0a66f87b..61b4ebc11f 100644 --- a/core/modules/media/src/OEmbed/ProviderRepository.php +++ b/core/modules/media/src/OEmbed/ProviderRepository.php @@ -100,6 +100,7 @@ public function getAll() { catch (ProviderException $e) { // Just skip all the invalid providers. // @todo Log the exception message to help with debugging. + // https://www.drupal.org/project/drupal/issues/2972846 } } diff --git a/core/modules/media/src/Plugin/Validation/Constraint/OEmbedResourceConstraintValidator.php b/core/modules/media/src/Plugin/Validation/Constraint/OEmbedResourceConstraintValidator.php index e39b2055cc..5bec132d34 100644 --- a/core/modules/media/src/Plugin/Validation/Constraint/OEmbedResourceConstraintValidator.php +++ b/core/modules/media/src/Plugin/Validation/Constraint/OEmbedResourceConstraintValidator.php @@ -137,10 +137,17 @@ protected function handleException(\Exception $e, $error_message = NULL) { // The oEmbed system makes heavy use of exception wrapping, so log the // entire exception chain to help with troubleshooting. do { - // @todo If $e is a ProviderException or ResourceException, log additional - // debugging information contained in those exceptions in - // https://www.drupal.org/project/drupal/issues/2972846. - $this->logger->error($e->getMessage()); + $message = $e->getMessage(); + $context = []; + if ($e->getUrl()) { + $message .= ' URL: {url}.'; + $context['url'] = $e->getUrl(); + } + if ($e->getData()) { + $message .= ' Data:
{data}
'; + $context['data'] = var_export($e->getData(), TRUE); + } + $this->logger->error($message, $context); $e = $e->getPrevious(); } while ($e); } diff --git a/core/modules/media/src/Plugin/media/Source/OEmbed.php b/core/modules/media/src/Plugin/media/Source/OEmbed.php index e7417c0018..46d5c9ca82 100644 --- a/core/modules/media/src/Plugin/media/Source/OEmbed.php +++ b/core/modules/media/src/Plugin/media/Source/OEmbed.php @@ -422,7 +422,9 @@ protected function getLocalThumbnailUri(Resource $resource) { } } catch (TransferException $e) { - $this->logger->warning($e->getMessage()); + $this->logger->warning($e->getMessage() . '. Request was GET: {uri}', [ + 'uri' => (string) $e->getRequest()->getUri(), + ]); } catch (FileException $e) { $this->logger->warning('Could not download remote thumbnail from {url}.', [