MCPcopy Index your code
hub / github.com/mkdocs/mkdocs / PluginRaisingError

Class PluginRaisingError

mkdocs/tests/plugin_tests.py:270–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268 build_errors = []
269
270 class PluginRaisingError(plugins.BasePlugin):
271 def __init__(self, error_on):
272 self.error_on = error_on
273
274 def on_pre_page(self, page, **kwargs):
275 if self.error_on == 'pre_page':
276 raise BuildError('pre page error')
277 return page
278
279 def on_page_markdown(self, markdown, **kwargs):
280 if self.error_on == 'page_markdown':
281 raise BuildError('page markdown error')
282 return markdown
283
284 def on_page_content(self, html, **kwargs):
285 if self.error_on == 'page_content':
286 raise PluginError('page content error')
287 return html
288
289 def on_post_page(self, html, **kwargs):
290 if self.error_on == 'post_page':
291 raise ValueError('post page error')
292
293 def on_build_error(self, error, **kwargs):
294 build_errors.append(error)
295
296 cfg = load_config(site_dir=site_dir)
297 cfg.plugins['errorplugin'] = PluginRaisingError(error_on='pre_page')

Callers 1

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…