未验证 提交 9827c8b5 编写于 作者: S Sing_chan 提交者: GitHub

improve error info when no sample code found (#42742)

* test=document_fix

* exit 1 if no sample code found since api must have sample code;test=document_fix

* test normal input;test=document_fix

* delete test code;test=document_fix
上级 106083aa
...@@ -339,8 +339,10 @@ def sampcd_extract_to_file(srccom, name, htype="def", hname=""): ...@@ -339,8 +339,10 @@ def sampcd_extract_to_file(srccom, name, htype="def", hname=""):
Please use '.. code-block:: python' to format the sample code.""") Please use '.. code-block:: python' to format the sample code.""")
return [] return []
else: else:
logger.warning("Error: No sample code!") logger.error(
return [] "Error: No sample code found! Please check if the API comment contais string 'Examples:' correctly"
)
exit(1)
sample_code_filenames = [] sample_code_filenames = []
for y, cb in enumerate(codeblocks): for y, cb in enumerate(codeblocks):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册