#130 cli: don't silently consume all AttributeErrors
Merged 3 years ago by kparal. Opened 3 years ago by kparal.

file modified
+4 -3
@@ -341,13 +341,14 @@ 

  

      args = parser.parse_args()

  

-     try:

-         args.func(args)

-     except AttributeError:

+     if not hasattr(args, 'func'):

          # if func attribute is missing, no command was specified, print help and exit

          parser.print_help()

          sys.exit(1)

  

+     # run the requested command

+     args.func(args)

+ 

  

  if __name__ == '__main__':

      exit = main()

The way it was written, it consumed all AttributeErrors that happened anywhere
in the project, and exited the program (with a cmdline help message) without
printing any traceback. Now it prints the error as it should.

Commit d11a4b2 fixes this pull-request

Pull-Request has been merged by kparal

3 years ago
Metadata