Problem/Motivation
When generating the static site on a Drupal site, not all errors are caught. TypeError extends Throwable and not Exception, so the static site generation breaks with
The website encountered an unexpected error. Please try again later.
TypeError: Symfony\Component\HttpFoundation\InputBag::get(): Argument #1 ($key) must be of type string, null given, called in /var/www/html/web/core/lib/Drupal/Core/Routing/RouteMatch.php on line 127 in Symfony\Component\HttpFoundation\InputBag->get() (line 28 of /var/www/html/vendor/symfony/http-foundation/InputBag.php).
Drupal\Core\Routing\RouteMatch->getRawParameter(NULL) (Line: 63)
Drupal\field_ui\Access\FieldReuseAccessCheck->access(Object, Object, Object, '')
call_user_func_array(Array, Array) (Line: 160)
Drupal\Core\Access\AccessManager->performCheck('access_check.field_ui.field_reuse', Object) (Line: 136)
Drupal\Core\Access\AccessManager->check(Object, Object, NULL, ) (Line: 93)
Drupal\Core\Access\AccessManager->checkNamedRoute('field_ui.field_storage_config_reuse_menu_link_content', Array, NULL, ) (Line: 832)
Drupal\Core\Url->access() (Line: 62)
Drupal\tome_static\EventSubscriber\RoutePathSubscriber->collectPaths(Object, 'tome_static.collect_paths', Object)
call_user_func(Array, Object, 'tome_static.collect_paths', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'tome_static.collect_paths') (Line: 118)
Drupal\tome_static\StaticGenerator->getPaths() (Line: 156)
Drupal\tome_static\Form\StaticGeneratorForm->submitForm(Array, Object)
Steps to reproduce
In my site, having "Custom Menu Links (menu_link_content)" core module enabled made it fail. That module has an entity without bundle and the if ($path && $url->access()) {
line in tome_static...RoutePathSubscriber.php
throws the TypeError as seen above.
Proposed resolution
Change \Exception
for \Throwable
when trying to catch possible exceptions.
Remaining tasks
MR.
User interface changes
API changes
Data model changes