Skip to content

Commit

Permalink
Print warning if requested entry not present in the file
Browse files Browse the repository at this point in the history
  • Loading branch information
kjvbrt committed Sep 22, 2023
1 parent 0cf68a8 commit 04a71f6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tools/podio-dump
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def print_frame(frame, cat_name, ientry, detailed):
ientry (int): The entry number of this Frame
detailed (bool): Print just an overview or dump the whole contents
"""
print('{:#^82}'.format(f' {cat_name} {ientry} ')) # pylint: disable=consider-using-f-string
print('{:#^82}'.format(f' {cat_name}: {ientry} ')) # pylint: disable=consider-using-f-string

if detailed:
print_frame_detailed(frame)
Expand Down Expand Up @@ -126,7 +126,11 @@ def main(args):

frames = reader.get(args.category)
for ient in args.entries:
print_frame(frames[ient], args.category, ient, args.detailed)
try:
print_frame(frames[ient], args.category, ient, args.detailed)
except IndexError:
print(f'WARNING: Entry no. {ient} in "{args.category}" not present in the file!')
pass


def parse_entry_range(ent_string):
Expand Down

0 comments on commit 04a71f6

Please sign in to comment.