forked from readthedocs/readthedocs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexceptions.py
82 lines (57 loc) · 2.42 KB
/
exceptions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# -*- coding: utf-8 -*-
"""Exceptions raised when building documentation."""
from django.utils.translation import ugettext_noop
class BuildEnvironmentException(Exception):
message = None
status_code = None
def __init__(self, message=None, **kwargs):
self.status_code = kwargs.pop(
'status_code',
None,
) or self.status_code or 1
message = message or self.get_default_message()
super().__init__(message, **kwargs)
def get_default_message(self):
return self.message
class BuildEnvironmentError(BuildEnvironmentException):
GENERIC_WITH_BUILD_ID = ugettext_noop(
'There was a problem with Read the Docs while building your documentation. '
'Please try again later. '
'However, if this problem persists, '
'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 in your project\'s 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}',
)
INVALID_DOCS_DIR_CONFIG = ugettext_noop(
'The "docs_dir" config from your MkDocs YAML config file has to be a '
'string with relative or absolute path.',
)
INVALID_DOCS_DIR_PATH = ugettext_noop(
'The "docs_dir" config from your MkDocs YAML config file does not '
'contain a valid path.',
)
INVALID_EXTRA_CONFIG = ugettext_noop(
'The "{config}" config from your MkDocs YAML config file has to be a '
'a list of relative paths.',
)
NOT_FOUND = ugettext_noop(
'A configuration file was not found. '
'Make sure you have a "mkdocs.yaml" file in your repository.',
)