bt2: trace collection notif. iter.: try to check the query result
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 16 Sep 2017 05:05:20 +0000 (01:05 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 17 Sep 2017 18:10:51 +0000 (14:10 -0400)
This could fail if the structure is not as expected: just raise
bt2.Error in this case.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
bindings/python/bt2/bt2/trace_collection_notification_iterator.py

index 179ac357a89e049b216a872062be5e727fe3ca91..d7f1ae5eb4a6d342ae25e81eda0388cfeb122b83 100644 (file)
@@ -128,12 +128,15 @@ class TraceCollectionNotificationIterator(bt2.notification_iterator._Notificatio
         end = None
 
         # find the trace info for this port's trace by name's prefix
-        for trace_info in trace_info_res:
-            if port.name.startswith(str(trace_info['path'])):
-                range_ns = trace_info['intersection-range-ns']
-                begin = range_ns['begin']
-                end = range_ns['end']
-                break
+        try:
+            for trace_info in trace_info_res:
+                if port.name.startswith(str(trace_info['path'])):
+                    range_ns = trace_info['intersection-range-ns']
+                    begin = range_ns['begin']
+                    end = range_ns['end']
+                    break
+        except:
+            pass
 
         if begin is None or end is None:
             raise bt2.Error('cannot find stream intersection range for port "{}"'.format(port.name))
This page took 0.024924 seconds and 4 git commands to generate.