def _cli(self, name, command, *args): try: func = self.cmds_by_name[command.lower()] except KeyError: guess = util.closest_option(command, list(self.cmds_by_name)) if guess: raise errors.ArgumentError( 'Unknown command "{0}". Did you mean "{1}"?'.format( command, guess)) raise errors.ArgumentError('Unknown command "{0}"'.format(command)) return func('{0} {1}'.format(name, command), *args)
def func(): raise errors.ArgumentError('test_catch_argumenterror')
def func(): raise errors.ArgumentError("test_run_fail_exit")
def _convert_ioerror(arg, exc): nexc = errors.ArgumentError('{0.strerror}: {1!r}'.format(exc, arg)) nexc.__cause__ = exc return nexc
def cli(self, name, command, *args): try: func = self.cmds_by_name[command] except KeyError: raise errors.ArgumentError('Unknwon command "{0}"'.format(command)) return func('{0} {1}'.format(name, command), *args)