Path() is a twig function which is used to generate a relative url path of the given route name. In case if route name does not exist or invalid, it returns an following exception:
The website encountered an unexpected error. Please try again later.Symfony\Component\Routing\Exception\RouteNotFoundException: Route "[ROUTE_NAME]" does not exist.
How to Reproduce.
- use function path() in a twig file and pass a route_name and parameters in path() function
- Now uninstall module that define route_name which is passed in path() twig function.
- Reload Drupal page which load twig file where path() function is called.
- Now you can see RouteNotFoundException
Proposed Solution
Path() function should return empty string or NULL if module that define route_name is not enabled.