From cccf6a5b85359ede9bafa8d05fe302be8f4dcf78 Mon Sep 17 00:00:00 2001 From: Konrad Malawski Date: Thu, 8 Oct 2015 12:00:09 +0200 Subject: [PATCH] +doc #18670 log errors when included snippet empty Forward port of #18670 --- akka-docs/_sphinx/exts/includecode.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/akka-docs/_sphinx/exts/includecode.py b/akka-docs/_sphinx/exts/includecode.py index 7ea125f6ed..af5684e786 100644 --- a/akka-docs/_sphinx/exts/includecode.py +++ b/akka-docs/_sphinx/exts/includecode.py @@ -109,6 +109,11 @@ class IncludeCode(Directive): return count nonempty = filter(lambda l: l.strip(), lines) + if not nonempty: + return [document.reporter.error( + "Snippet ({}#{}) not found!".format(filename, section), + line=self.lineno + )] tabcounts = map(lambda l: countwhile(lambda c: c == ' ', l), nonempty) tabshift = min(tabcounts) if tabcounts else 0