diff --git a/Controller/SwaggerUiController.php b/Controller/SwaggerUiController.php index 5bacbbd..fc2ca27 100644 --- a/Controller/SwaggerUiController.php +++ b/Controller/SwaggerUiController.php @@ -11,7 +11,7 @@ namespace Nelmio\ApiDocBundle\Controller; -use InvalidArgumentException; +use Nelmio\ApiDocBundle\Exception\RenderInvalidArgumentException; use Nelmio\ApiDocBundle\Render\Html\AssetsMode; use Nelmio\ApiDocBundle\Render\RenderOpenApi; use Symfony\Component\HttpFoundation\Request; @@ -42,7 +42,7 @@ final class SwaggerUiController ); return $response->setCharset('UTF-8'); - } catch (InvalidArgumentException $e) { + } catch (RenderInvalidArgumentException $e) { $advice = ''; if (false !== strpos($area, '.json')) { $advice = ' Since the area provided contains `.json`, the issue is likely caused by route priorities. Try switching the Swagger UI / the json documentation routes order.'; diff --git a/Exception/RenderInvalidArgumentException.php b/Exception/RenderInvalidArgumentException.php new file mode 100644 index 0000000..ffb0b00 --- /dev/null +++ b/Exception/RenderInvalidArgumentException.php @@ -0,0 +1,16 @@ +generatorLocator->has($area)) { - throw new InvalidArgumentException(sprintf('Area "%s" is not supported.', $area)); + throw new RenderInvalidArgumentException(sprintf('Area "%s" is not supported.', $area)); } elseif (!array_key_exists($format, $this->openApiRenderers)) { - throw new InvalidArgumentException(sprintf('Format "%s" is not supported.', $format)); + throw new RenderInvalidArgumentException(sprintf('Format "%s" is not supported.', $format)); } /** @var OpenApi $spec */