- Issue created by @joachim
- Assigned to mohd sahzad
- Issue was unassigned.
- Status changed to Needs review
10 months ago 12:32pm 17 January 2024 - Open on Drupal.org →Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.7last update
10 months ago Waiting for branch to pass - 🇮🇳India mohd sahzad
I have created the patch related to this issue. Please review the attached patch.
- 🇬🇧United Kingdom joachim
+++ b/modules/tome_static/src/StaticGenerator.php @@ -161,6 +161,16 @@ class StaticGenerator implements StaticGeneratorInterface { catch (\Exception $e) { + + // Log the error for debugging purposes
This shouldn't be in the catch() block -- that is for catching an exception caused by the system making the request.
What this issue is about is dealing with the $response being a 500.
As well as logging, we need to figure out a way to return an error to the user, whether that's Drush or Batch API, and also to the originator of the export so a failure can be registered with this: ✨ Add a finish event for static HTML generator batch Needs work .
- Status changed to Needs work
10 months ago 3:42pm 31 January 2024 - 🇬🇧United Kingdom joachim
I can add this in StaticGenerator:
elseif ($response->isServerError()) { throw new \Exception(); }
and that exception is caught here in StaticExportPathCommand:
foreach ($paths as $path) { $this->requestPreparer->prepareForRequest(); try { $invoke_paths = array_merge($this->static->requestPath($path), $invoke_paths); } catch (\Exception $e) { $this->io->getErrorStyle()->error($this->formatPathException($path, $e)); } }
but that output that should be shown on the CLI isn't.
Is Tome doing something to suppress that?
- 🇬🇧United Kingdom joachim
There is some sort of collection of errors from the process:
if (!$is_running) { if (!$process->isSuccessful()) { $error_output = $process->getErrorOutput(); $collected_errors[] = "Error when running \"{$command}\":\n $error_output"; }
but that's only output if the process reports success.