mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-25 06:10:22 -07: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 = ''
|
||||
for module in self.args:
|
||||
|
||||
try:
|
||||
filename = module_loader.find_plugin(module)
|
||||
if filename is None:
|
||||
self.display.warning("module %s not found in %s\n" % (module, DocCLI.print_paths(module_loader)))
|
||||
|
@ -117,7 +118,9 @@ class DocCLI(CLI):
|
|||
else:
|
||||
# this typically means we couldn't even parse the docstring, not just that the YAML is busted,
|
||||
# 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)
|
||||
return 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue