Problem/Motivation

This exception should better be logged and an error placeholder should be shown instead of killing the whole page with an exception:

Drupal\media\OEmbed\ResourceException: No matching provider found. in Drupal\media\OEmbed\UrlResolver->getProviderByUrl() (line 144 of core/modules/media/src/OEmbed/UrlResolver.php).

Backtrace:

Drupal\vidstack_player\Plugin\Field\FieldFormatter\VidstackPlayerRemoteVideoFormatter->usesValidProvider() (Line: 180)
Drupal\vidstack_player\Plugin\Field\FieldFormatter\VidstackPlayerRemoteVideoFormatter->viewElements() (Line: 91)
Drupal\Core\Field\FormatterBase->view() (Line: 275)
Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple() (Line: 288)
Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->buildMultiple() (Line: 341)
Drupal\Core\Entity\EntityViewBuilder->buildComponents() (Line: 283)
Drupal\Core\Entity\EntityViewBuilder->buildMultiple() (Line: 240)
Drupal\Core\Entity\EntityViewBuilder->build()
call_user_func_array() (Line: 107)
Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 876)
Drupal\Core\Render\Renderer->doCallback() (Line: 438)
Drupal\Core\Render\Renderer->doRender() (Line: 510)
Drupal\Core\Render\Renderer->doRender() (Line: 227)
Drupal\Core\Render\Renderer->render() (Line: 491)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 670)
__TwigTemplate_7caf6727f5d06a0b4314157cd05b9935->block_node_content() (Line: 446)
Twig\Template->yieldBlock() (Line: 506)
__TwigTemplate_7caf6727f5d06a0b4314157cd05b9935->block_node() (Line: 446)
Twig\Template->yieldBlock() (Line: 98)
__TwigTemplate_7caf6727f5d06a0b4314157cd05b9935->doDisplay() (Line: 402)
Twig\Template->yield() (Line: 358)
Twig\Template->display() (Line: 373)
Twig\Template->render() (Line: 51)
Twig\TemplateWrapper->render() (Line: 34)
twig_render_template() (Line: 380)
Drupal\Core\Theme\ThemeManager->render() (Line: 497)
Drupal\Core\Render\Renderer->doRender() (Line: 227)
Drupal\Core\Render\Renderer->render() (Line: 242)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 235)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare() (Line: 131)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray() (Line: 246)
Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}() (Line: 206)
Symfony\Component\EventDispatcher\EventDispatcher->callListeners() (Line: 56)
Symfony\Component\EventDispatcher\EventDispatcher->dispatch() (Line: 188)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 50)
Drupal\ban\BanMiddleware->handle() (Line: 97)
Drupal\crowdsec\Middleware->handle() (Line: 263)
Drupal\shield\ShieldMiddleware->bypass() (Line: 162)
Drupal\shield\ShieldMiddleware->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 53)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 49)
Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 715)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

anybody created an issue. See original summary.

grevil made their first commit to this issue’s fork.

grevil’s picture

Assigned: grevil » Unassigned
Status: Active » Needs review

All done, please review!

anybody’s picture

Status: Needs review » Needs work

Commented! I think that's good enough for the start then.

thomas.frobieter’s picture

Status: Needs work » Needs review

My 2 cent for the Twig template:

name: vidstack-error-placeholder.html.twig

Markup:

<div class="vidstack-error-placeholder">
  <span class="vidstack-error-placeholder__message">{{ message }}></span>
</div>

I'm not sure about adding default styles. It would be nice to have this placeholder with an aspect ratio of 16:9.

  .vidstack-error-placeholder{
   display: flex;
   align-items: center;
   justify-content: center;
   padding: 1rem;
   aspect-ratio: 16/9;
   background-color: rgba(0,0,0,0.1);
  }
anybody’s picture

Status: Needs review » Needs work

#6 +1!

And pass helpful some helpful information, e.g. from the exception as variables that can be used.

lrwebks made their first commit to this issue’s fork.

lrwebks’s picture

Status: Needs work » Needs review
StatusFileSize
new20.42 KB

Everything implemented and working properly now!
I'll attach a screenshot of how the error currently looks. (Of course YouTube videos are supported, I just artificially produced that error to see how it looks.)

anybody’s picture

Assigned: Unassigned » lrwebks
Status: Needs review » Needs work

#7 is still unresolved. I left some comments for better architecture and namings.

lrwebks’s picture

Status: Needs work » Needs review
anybody’s picture

Assigned: lrwebks » thomas.frobieter
Status: Needs review » Needs work

Last point (adding that class to indicate the type) is for @thomas.frobieter - afterwards, I think this is good enough to go! Thanks!

thomas.frobieter’s picture

Status: Needs work » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

grevil’s picture

Created a new release. Thanks everyone!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.