Dump full stacktrace in idea.log for errors during docstring rendering
authorMikhail Golubev <mikhail.golubev@jetbrains.com>
Thu, 24 Sep 2015 14:35:49 +0000 (17:35 +0300)
committerMikhail Golubev <mikhail.golubev@jetbrains.com>
Fri, 25 Sep 2015 12:38:34 +0000 (15:38 +0300)
python/helpers/google_formatter.py
python/helpers/numpy_formatter.py
python/helpers/rest_formatter.py
python/src/com/jetbrains/python/documentation/docstrings/PyStructuredDocstringFormatter.java

index 3d8e021385a12792afd2d6f7dcdd48de8909f70f..296e8a2a0f53464e1d39fd82a65f66af0ef16d96 100644 (file)
@@ -1,19 +1,14 @@
 import sys
-
-from sphinxcontrib.napoleon.docstring import GoogleDocstring
+import textwrap
 
 import rest_formatter
+from sphinxcontrib.napoleon.docstring import GoogleDocstring
 
 
 def main(text=None):
-  try:
     src = sys.stdin.read() if text is None else text
-    import textwrap
     rest_formatter.main(str(GoogleDocstring(textwrap.dedent(src))))
-  except:
-    exc_type, exc_value, exc_traceback = sys.exc_info()
-    sys.stderr.write("Error calculating docstring: " + str(exc_value))
 
 
 if __name__ == '__main__':
-  main()
+    main()
index fbbe0237a60c6edd6d365dc57267a467549176a2..9a02e31a33bb534bc9ac29ced7d2f8381389e53d 100644 (file)
@@ -1,19 +1,14 @@
 import sys
-
-from sphinxcontrib.napoleon.docstring import NumpyDocstring
+import textwrap
 
 import rest_formatter
+from sphinxcontrib.napoleon.docstring import NumpyDocstring
 
 
 def main(text=None):
-  try:
     src = sys.stdin.read() if text is None else text
-    import textwrap
     rest_formatter.main(str(NumpyDocstring(textwrap.dedent(src))))
-  except:
-    exc_type, exc_value, exc_traceback = sys.exc_info()
-    sys.stderr.write("Error calculating docstring: " + str(exc_value))
 
 
 if __name__ == '__main__':
-  main()
+    main()
index 0004967b6b64f2602488b0c7b876028540e0be16..0802ca6d212bc1c852870773d687123bf0ce9792 100644 (file)
@@ -210,34 +210,28 @@ def parse_docstring(docstring, errors, **options):
 
 
 def main(text=None):
-    try:
-        src = sys.stdin.read() if text is None else text
+    src = sys.stdin.read() if text is None else text
 
-        errors = []
+    errors = []
 
-        class EmptyLinker(DocstringLinker):
-            def translate_indexterm(self, indexterm):
-                return ""
+    class EmptyLinker(DocstringLinker):
+        def translate_indexterm(self, indexterm):
+            return ""
 
-            def translate_identifier_xref(self, identifier, label=None):
-                return identifier
+        def translate_identifier_xref(self, identifier, label=None):
+            return identifier
 
-        docstring = parse_docstring(src, errors)
-        html = docstring.to_html(EmptyLinker())
+    docstring = parse_docstring(src, errors)
+    html = docstring.to_html(EmptyLinker())
 
-        if errors and not html:
-            sys.stderr.write("Error parsing docstring:\n")
-            for error in errors:
-                sys.stderr.write(str(error) + "\n")
-            sys.exit(1)
-
-        sys.stdout.write(html)
-        sys.stdout.flush()
-    except:
-        exc_type, exc_value, exc_traceback = sys.exc_info()
-        sys.stderr.write("Error calculating docstring: " + str(exc_value))
+    if errors and not html:
+        sys.stderr.write("Error parsing docstring:\n")
+        for error in errors:
+            sys.stderr.write(str(error) + "\n")
         sys.exit(1)
 
+    sys.stdout.write(html)
+    sys.stdout.flush()
 
 if __name__ == '__main__':
     main()
index aa509a33f1a2d488bab67dbfcd33ad0738db1d88..80ffbf8852dcab0aea42e5961407887bf808d4a3 100644 (file)
@@ -130,8 +130,7 @@ public class PyStructuredDocstringFormatter {
       return null;
     }
     else if (output.getExitCode() != 0) {
-      final String error = "error when calculating docstring: " + output.getStderr();
-      LOG.info(error);
+      LOG.info("error when calculating docstring: " + output.getStderr());
       return null;
     }
     return output.getStdout();