Skip to content

Commit 303d0c5

Browse files
committed
gracefully handle render errors
plugins may act up during text rendering, this should not abort the whole indexing. Instead we fall back to the page source
1 parent e125188 commit 303d0c5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Embeddings.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,15 @@ public function createPageChunks($page, $firstChunkID)
181181
if ($textRenderer instanceof PluginInterface) {
182182
global $ID;
183183
$ID = $page;
184-
$text = p_cached_output(wikiFN($page), 'text', $page);
184+
try {
185+
$text = p_cached_output(wikiFN($page), 'text', $page);
186+
} catch (\Throwable $e) {
187+
if ($this->logger) $this->logger->error(
188+
'Failed to render page {page} using raw text instead. {msg}',
189+
['page' => $page, 'msg' => $e->getMessage()]
190+
);
191+
$text = rawWiki($page);
192+
}
185193
} else {
186194
$text = rawWiki($page);
187195
}

0 commit comments

Comments
 (0)