mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
better error reporting when doc parsing fails
This commit is contained in:
parent
b27d762081
commit
faed1b2d05
1 changed files with 34 additions and 31 deletions
|
@ -81,6 +81,7 @@ class DocCLI(CLI):
|
||||||
text = ''
|
text = ''
|
||||||
for module in self.args:
|
for module in self.args:
|
||||||
|
|
||||||
|
try:
|
||||||
filename = module_loader.find_plugin(module)
|
filename = module_loader.find_plugin(module)
|
||||||
if filename is None:
|
if filename is None:
|
||||||
self.display.warning("module %s not found in %s\n" % (module, DocCLI.print_paths(module_loader)))
|
self.display.warning("module %s not found in %s\n" % (module, DocCLI.print_paths(module_loader)))
|
||||||
|
@ -117,7 +118,9 @@ class DocCLI(CLI):
|
||||||
else:
|
else:
|
||||||
# this typically means we couldn't even parse the docstring, not just that the YAML is busted,
|
# this typically means we couldn't even parse the docstring, not just that the YAML is busted,
|
||||||
# probably a quoting issue.
|
# probably a quoting issue.
|
||||||
self.display.warning("module %s missing documentation (or could not parse documentation)\n" % module)
|
raise AnsibleError("Parsing produced an empty object.")
|
||||||
|
except Exception, e:
|
||||||
|
raise AnsibleError("module %s missing documentation (or could not parse documentation): %s\n" % (module, str(e)))
|
||||||
|
|
||||||
CLI.pager(text)
|
CLI.pager(text)
|
||||||
return 0
|
return 0
|
||||||
|
|
Loading…
Reference in a new issue