Skip to content

Commit e81ddfd

Browse files
committedOct 19, 2015
Improve error reporting
1 parent 409a18e commit e81ddfd

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed
 

‎src/bag2h5.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ def main():
8686
iterbags = iter(bags) # Create iterator to allow tracking the status (see below)
8787
for b in iterbags:
8888
if not args.check_only:
89-
bag2h5(b, db, **args_dict)
89+
err = bag2h5(b, db, **args_dict)
90+
if err: # No need to check, we know it is not ok.
91+
continue
9092
checkh5bag(b, db, **args_dict)
9193
return 0
9294

‎src/ros2scipy/bag2h5.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def bag2h5(bag_path, db_path, db_root='/', topic_filter=None,
6262
debug("Raised error while parsing bag %s", bag_path, exc_info=True)
6363
warning(str(e))
6464
warning("Skipping bag %s", bag_path)
65-
return
65+
return 1
6666

6767
# Open the database
6868
with h5py.File(str(db_path), 'a') as db:
@@ -81,6 +81,8 @@ def bag2h5(bag_path, db_path, db_root='/', topic_filter=None,
8181
else:
8282
g.create_dataset(t, data=data)
8383

84+
return 0
85+
8486

8587
def checkh5bag(bag_path, db_path, db_root='/', topic_filter=set(), **kargs):
8688
bag_path = Path(bag_path)
@@ -89,7 +91,7 @@ def checkh5bag(bag_path, db_path, db_root='/', topic_filter=set(), **kargs):
8991

9092
db_path = Path(db_path)
9193
if not db_path.exists():
92-
raise ValueError("The file {} doesn't exists.".format(bag_path))
94+
raise ValueError("The file {} doesn't exists.".format(db_path))
9395

9496
bag = rosbag.Bag(str(bag_path))
9597
db = h5py.File(str(db_path))

0 commit comments

Comments
 (0)
Please sign in to comment.