diff --git a/ngsarchiver/cli.py b/ngsarchiver/cli.py index 8365581..a339999 100644 --- a/ngsarchiver/cli.py +++ b/ngsarchiver/cli.py @@ -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__) @@ -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 @@ -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")