Skip to content

Commit

Permalink
gracefully handle render errors
Browse files Browse the repository at this point in the history
plugins may act up during text rendering, this should not abort the
whole indexing. Instead we fall back to the page source
  • Loading branch information
splitbrain committed Jun 17, 2024
1 parent e125188 commit 303d0c5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Embeddings.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,15 @@ public function createPageChunks($page, $firstChunkID)
if ($textRenderer instanceof PluginInterface) {
global $ID;
$ID = $page;
$text = p_cached_output(wikiFN($page), 'text', $page);
try {
$text = p_cached_output(wikiFN($page), 'text', $page);
} catch (\Throwable $e) {
if ($this->logger) $this->logger->error(
'Failed to render page {page} using raw text instead. {msg}',
['page' => $page, 'msg' => $e->getMessage()]
);
$text = rawWiki($page);
}
} else {
$text = rawWiki($page);
}
Expand Down

0 comments on commit 303d0c5

Please sign in to comment.