diff --git a/core/lib/Drupal/Core/Url.php b/core/lib/Drupal/Core/Url.php index 604d3d6..c685c1a 100644 --- a/core/lib/Drupal/Core/Url.php +++ b/core/lib/Drupal/Core/Url.php @@ -298,11 +298,12 @@ public function setOption($name, $value) { * @return string * The external path. * - * @throws \Exception + * @throws \UnexpectedValueException + * Thrown when the path was requested for an internal URL. */ public function getPath() { if (!$this->isExternal()) { - throw new \Exception('Internal URLs do not have external paths.'); + throw new \UnexpectedValueException('Internal URLs do not have external paths.'); } return $this->path; } diff --git a/core/tests/Drupal/Tests/Core/UrlTest.php b/core/tests/Drupal/Tests/Core/UrlTest.php index 50ea4d3..668794f 100644 --- a/core/tests/Drupal/Tests/Core/UrlTest.php +++ b/core/tests/Drupal/Tests/Core/UrlTest.php @@ -206,7 +206,7 @@ public function testIsExternal($urls) { * * @depends testCreateFromPath * - * @expectedException \Exception + * @expectedException \UnexpectedValueException * * @covers ::getPath() */