From 9827c8b58b8cac88ae0db47aa193891f221ce5cb Mon Sep 17 00:00:00 2001 From: Sing_chan <51314274+betterpig@users.noreply.github.com> Date: Mon, 23 May 2022 10:46:33 +0800 Subject: [PATCH] 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 --- tools/sampcd_processor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/sampcd_processor.py b/tools/sampcd_processor.py index 2d8692c5bc..13005350d7 100644 --- a/tools/sampcd_processor.py +++ b/tools/sampcd_processor.py @@ -339,8 +339,10 @@ def sampcd_extract_to_file(srccom, name, htype="def", hname=""): Please use '.. code-block:: python' to format the sample code.""") return [] else: - logger.warning("Error: No sample code!") - return [] + logger.error( + "Error: No sample code found! Please check if the API comment contais string 'Examples:' correctly" + ) + exit(1) sample_code_filenames = [] for y, cb in enumerate(codeblocks): -- GitLab