Skip to content

Commit 895b25a

Browse files
committed
fix(symfony): catch InvalidUriVariableException in IriConverter
1 parent e40bb19 commit 895b25a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/Metadata/UriVariablesConverterInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
namespace ApiPlatform\Metadata;
1515

1616
use ApiPlatform\Metadata\Exception\InvalidIdentifierException;
17+
use ApiPlatform\Metadata\Exception\InvalidUriVariableException;
1718

1819
/**
1920
* Identifier converter.
@@ -29,6 +30,7 @@ interface UriVariablesConverterInterface
2930
* @param string $class The class to which the URI variables belong to
3031
*
3132
* @throws InvalidIdentifierException
33+
* @throws InvalidUriVariableException
3234
*
3335
* @return array Array indexed by identifiers properties with their values denormalized
3436
*/

src/Symfony/Routing/IriConverter.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use ApiPlatform\Metadata\CollectionOperationInterface;
1717
use ApiPlatform\Metadata\Exception\InvalidArgumentException;
1818
use ApiPlatform\Metadata\Exception\InvalidIdentifierException;
19+
use ApiPlatform\Metadata\Exception\InvalidUriVariableException;
1920
use ApiPlatform\Metadata\Exception\ItemNotFoundException;
2021
use ApiPlatform\Metadata\Exception\OperationNotFoundException;
2122
use ApiPlatform\Metadata\Exception\RuntimeException;
@@ -99,7 +100,7 @@ public function getResourceFromIri(string $iri, array $context = [], ?Operation
99100

100101
try {
101102
$uriVariables = $this->getOperationUriVariables($operation, $parameters, $attributes['resource_class']);
102-
} catch (InvalidIdentifierException $e) {
103+
} catch (InvalidIdentifierException|InvalidUriVariableException $e) {
103104
throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
104105
}
105106

0 commit comments

Comments
 (0)