diff --git a/sphinxarg/ext.py b/sphinxarg/ext.py
index <HASH>..<HASH> 100644
--- a/sphinxarg/ext.py
+++ b/sphinxarg/ext.py
@@ -210,9 +210,12 @@ class ArgParseDirective(Directive):
             module_name = '.'.join(_parts[0:-1])
             attr_name = _parts[-1]
         else:
-            raise ValueError(':module: and :func: should be specified, or :ref:')
+            raise self.error(':module: and :func: should be specified, or :ref:')
 
         mod = __import__(module_name, globals(), locals(), [attr_name])
+        if not hasattr(mod, attr_name):
+            raise self.error('Module "%s" has no attribute "%s"\nIncorrect argparse :module: or :func: values?' % (module_name, attr_name))
+
         func = getattr(mod, attr_name)
 
         if isinstance(func, ArgumentParser):
Raise exceptions with the builtin sphinx extension mechanism.  Raise a more informative error if a module is missing the function specified in :func: