Closed (fixed)
Project:
Tome
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Jan 2024 at 10:24 UTC
Updated:
25 Jan 2024 at 05:29 UTC
Jump to comment: Most recent
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)
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.
Change \Exception for \Throwable when trying to catch possible exceptions.
MR.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
fjgarlin commentedProposed change in the MR. Please review.
Comment #6
larowlanThanks