Skip to content

Commit

Permalink
cli: nicer handling of exceptions when trying to load non-existent ru…
Browse files Browse the repository at this point in the history
…n directories.
  • Loading branch information
pjbriggs committed Nov 29, 2023
1 parent 37a7e87 commit be7f212
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions ngsarchiver/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@ def main(argv=None):

# 'Info' subcommand
if args.subcommand == "info":
d = get_rundir_instance(args.dir)
try:
d = get_rundir_instance(args.dir)
except Exception as ex:
logger.error(ex)
return CLIStatus.ERROR
size = d.size
print("Path: %s" % d.path)
print("Type: %s" % d.__class__.__name__)
Expand Down Expand Up @@ -235,7 +239,11 @@ def main(argv=None):

# 'Archive' subcommand
if args.subcommand == "archive":
d = get_rundir_instance(args.dir)
try:
d = get_rundir_instance(args.dir)
except Exception as ex:
logger.error(ex)
return CLIStatus.ERROR
size = d.size
largest_file = d.largest_file
check_status = 0
Expand Down Expand Up @@ -394,7 +402,11 @@ def main(argv=None):

# 'Compare' subcommand
if args.subcommand == 'compare':
d1 = get_rundir_instance(args.dir1)
try:
d1 = get_rundir_instance(args.dir1)
except Excepion as ex:
logger.error(ex)
return CLIStatus.ERROR
print("Comparing %s against %s" % (d1,args.dir2))
if d1.verify_copy(args.dir2):
print("-- ok")
Expand Down

0 comments on commit be7f212

Please sign in to comment.