10586: Suppress stack traces for expected http errors.
[arvados.git] / sdk / python / tests / performance / performance_profiler.py
index 7f0766e3ef38fe95e7c7b9e6e9d3ef258fa2de4c..afa53ae73c0d2eb5231054889eedbcc3563c202d 100644 (file)
@@ -38,12 +38,12 @@ def profiled(function):
         pr.enable()
         try:
             ret = function(*args, **kwargs)
-        except:
-            caught = sys.exc_info()[0]
+        except Exception as e:
+            caught = e
         pr.disable()
         ps = pstats.Stats(pr, stream=outfile)
-        ps.print_stats()
+        ps.sort_stats('time').print_stats()
         if caught:
-            raise caught
+            raise
         return ret
     return profiled_function