Its possible URLs are malformed when calling methods on an entity:

// Throws \Drupal\Core\Entity\Exception\UndefinedLinkTemplateException|\Drupal\Core\Entity\EntityMalformedException
$url = $entity->toUrl();
// Throws \UnexpectedValueException
$url->getInternalPath();
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dpi created an issue. See original summary.

dpi’s picture

Status: Active » Needs review
FileSize
1.27 KB
jibran’s picture

Status: Needs review » Reviewed & tested by the community

This always bothered me. Nice catch. Pun intended ;-)

Berdir’s picture

Status: Reviewed & tested by the community » Fixed

Thanks.

  • Berdir committed 8b684be on 8.x-1.x authored by dpi
    Issue #3059012 by dpi: Catch exceptions thrown by toUrl and...

Status: Fixed » Closed (fixed)

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