Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MkDocsYAMLParseError #4814

Merged
merged 1 commit into from
Nov 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions readthedocs/doc_builder/backends/mkdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from django.template import loader as template_loader

from readthedocs.doc_builder.base import BaseBuilder
from readthedocs.doc_builder.exceptions import BuildEnvironmentError
from readthedocs.doc_builder.exceptions import MkDocsYAMLParseError
from readthedocs.projects.models import Feature

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -99,7 +99,7 @@ def load_yaml_config(self):
if hasattr(exc, 'problem_mark'):
mark = exc.problem_mark
note = ' (line %d, column %d)' % (mark.line + 1, mark.column + 1)
raise BuildEnvironmentError(
raise MkDocsYAMLParseError(
'Your mkdocs.yml could not be loaded, '
'possibly due to a syntax error{note}'.format(note=note)
)
Expand Down
3 changes: 2 additions & 1 deletion readthedocs/doc_builder/environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from .exceptions import (
BuildEnvironmentCreationFailed, BuildEnvironmentError,
BuildEnvironmentException, BuildEnvironmentWarning, BuildTimeoutError,
ProjectBuildsSkippedError, VersionLockedError, YAMLParseError)
ProjectBuildsSkippedError, VersionLockedError, YAMLParseError, MkDocsYAMLParseError)

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -438,6 +438,7 @@ class BuildEnvironment(BaseEnvironment):
ProjectBuildsSkippedError,
YAMLParseError,
BuildTimeoutError,
MkDocsYAMLParseError
)

def __init__(self, project=None, version=None, build=None, config=None,
Expand Down
13 changes: 6 additions & 7 deletions readthedocs/doc_builder/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class BuildEnvironmentException(Exception):

message = None
status_code = None

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


class BuildEnvironmentError(BuildEnvironmentException):

GENERIC_WITH_BUILD_ID = ugettext_noop(
'There was a problem with Read the Docs while building your documentation. '
'Please report this to us with your build id ({build_id}).',
)


class BuildEnvironmentCreationFailed(BuildEnvironmentError):

message = ugettext_noop('Build environment creation failed')


class VersionLockedError(BuildEnvironmentError):

message = ugettext_noop('Version locked, retrying in 5 minutes.')
status_code = 423


class ProjectBuildsSkippedError(BuildEnvironmentError):

message = ugettext_noop('Builds for this project are temporarily disabled')


class YAMLParseError(BuildEnvironmentError):

GENERIC_WITH_PARSE_EXCEPTION = ugettext_noop(
'Problem parsing YAML configuration. {exception}',
)


class BuildTimeoutError(BuildEnvironmentError):

message = ugettext_noop('Build exited due to time out')


class BuildEnvironmentWarning(BuildEnvironmentException):
pass


class MkDocsYAMLParseError(BuildEnvironmentError):
GENERIC_WITH_PARSE_EXCEPTION = ugettext_noop(
'Problem parsing MkDocs YAML configuration. {exception}',
)