Debian Codegraph @

mkdocs/exceptions.py

raw
1 from __future__ import annotations
2
3 from click import ClickException, echo
4
5
6 class MkDocsException(ClickException):
7 """
8 The base class which all MkDocs exceptions inherit from. This should
9 not be raised directly. One of the subclasses should be raised instead.
10 """
11
12
13 class Abort(MkDocsException, SystemExit):
14 """Abort the build."""
15
16 code = 1
17
18 def show(self, *args, **kwargs) -> None:
19 echo('\n' + self.format_message())
20
21
22 class ConfigurationError(MkDocsException):
23 """
24 This error is raised by configuration validation when a validation error
25 is encountered. This error should be raised by any configuration options
26 defined in a plugin's [config_scheme][].
27 """
28
29
30 class BuildError(MkDocsException):
31 """
32 This error may be raised by MkDocs during the build process. Plugins should
33 not raise this error.
34 """
35
36
37 class PluginError(BuildError):
38 """
39 A subclass of [`mkdocs.exceptions.BuildError`][] which can be raised by plugin
40 events.
41 """