Skip to content

Commit 1bcc070

Browse files
committed
Add MkDocsYAMLParseError
1 parent dfc8fc9 commit 1bcc070

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

readthedocs/doc_builder/backends/mkdocs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from django.template import loader as template_loader
1616

1717
from readthedocs.doc_builder.base import BaseBuilder
18-
from readthedocs.doc_builder.exceptions import BuildEnvironmentError
18+
from readthedocs.doc_builder.exceptions import MkDocsYAMLParseError
1919
from readthedocs.projects.models import Feature
2020

2121
log = logging.getLogger(__name__)
@@ -99,7 +99,7 @@ def load_yaml_config(self):
9999
if hasattr(exc, 'problem_mark'):
100100
mark = exc.problem_mark
101101
note = ' (line %d, column %d)' % (mark.line + 1, mark.column + 1)
102-
raise BuildEnvironmentError(
102+
raise MkDocsYAMLParseError(
103103
'Your mkdocs.yml could not be loaded, '
104104
'possibly due to a syntax error{note}'.format(note=note)
105105
)

readthedocs/doc_builder/environments.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
from .exceptions import (
3838
BuildEnvironmentCreationFailed, BuildEnvironmentError,
3939
BuildEnvironmentException, BuildEnvironmentWarning, BuildTimeoutError,
40-
ProjectBuildsSkippedError, VersionLockedError, YAMLParseError)
40+
ProjectBuildsSkippedError, VersionLockedError, YAMLParseError, MkDocsYAMLParseError)
4141

4242
log = logging.getLogger(__name__)
4343

@@ -438,6 +438,7 @@ class BuildEnvironment(BaseEnvironment):
438438
ProjectBuildsSkippedError,
439439
YAMLParseError,
440440
BuildTimeoutError,
441+
MkDocsYAMLParseError
441442
)
442443

443444
def __init__(self, project=None, version=None, build=None, config=None,

readthedocs/doc_builder/exceptions.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88

99
class BuildEnvironmentException(Exception):
10-
1110
message = None
1211
status_code = None
1312

@@ -21,40 +20,40 @@ def get_default_message(self):
2120

2221

2322
class BuildEnvironmentError(BuildEnvironmentException):
24-
2523
GENERIC_WITH_BUILD_ID = ugettext_noop(
2624
'There was a problem with Read the Docs while building your documentation. '
2725
'Please report this to us with your build id ({build_id}).',
2826
)
2927

3028

3129
class BuildEnvironmentCreationFailed(BuildEnvironmentError):
32-
3330
message = ugettext_noop('Build environment creation failed')
3431

3532

3633
class VersionLockedError(BuildEnvironmentError):
37-
3834
message = ugettext_noop('Version locked, retrying in 5 minutes.')
3935
status_code = 423
4036

4137

4238
class ProjectBuildsSkippedError(BuildEnvironmentError):
43-
4439
message = ugettext_noop('Builds for this project are temporarily disabled')
4540

4641

4742
class YAMLParseError(BuildEnvironmentError):
48-
4943
GENERIC_WITH_PARSE_EXCEPTION = ugettext_noop(
5044
'Problem parsing YAML configuration. {exception}',
5145
)
5246

5347

5448
class BuildTimeoutError(BuildEnvironmentError):
55-
5649
message = ugettext_noop('Build exited due to time out')
5750

5851

5952
class BuildEnvironmentWarning(BuildEnvironmentException):
6053
pass
54+
55+
56+
class MkDocsYAMLParseError(BuildEnvironmentError):
57+
GENERIC_WITH_PARSE_EXCEPTION = ugettext_noop(
58+
'Problem parsing MkDocs YAML configuration. {exception}',
59+
)

0 commit comments

Comments
 (0)