Skip to content

Commit b34f50e

Browse files
committed
feat: Improve error message for missing mkdocs.yml
1 parent acaf4e0 commit b34f50e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

readthedocs/doc_builder/backends/mkdocs.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from readthedocs.doc_builder.base import BaseBuilder
1515
from readthedocs.projects.constants import MKDOCS
1616
from readthedocs.projects.constants import MKDOCS_HTML
17-
17+
from readthedocs.projects.exceptions import UserFileNotFound
1818

1919
log = structlog.get_logger(__name__)
2020

@@ -52,7 +52,12 @@ def get_final_doctype(self):
5252
5353
https://www.mkdocs.org/user-guide/configuration/#use_directory_urls
5454
"""
55-
55+
# Check if the mkdocs.yml file exists before trying to open it.
56+
if not os.path.exists(self.yaml_file):
57+
raise UserFileNotFound(
58+
"MkDocs configuration file is missing. "
59+
"A configuration file named `mkdocs.yml` was not found in your repository."
60+
)
5661
# TODO: we should eventually remove this method completely and stop
5762
# relying on "loading the `mkdocs.yml` file in a safe way just to know
5863
# if it's a MKDOCS or MKDOCS_HTML documentation type".

0 commit comments

Comments
 (0)