qvm-block & qvm-pool add better Exception handling

This commit is contained in:
Bahtiar `kalkin-` Gadimov 2016-08-16 19:18:19 +02:00
parent b712d0f6f3
commit c0f1a6b4e8
No known key found for this signature in database
GPG Key ID: 96ED3C3BA19C3DEE
2 changed files with 13 additions and 3 deletions

View File

@ -228,8 +228,13 @@ def get_parser():
def main(args=None):
'''Main routine of :program:`qvm-block`.'''
args = get_parser().parse_args(args)
args.func(args)
parser = get_parser()
try:
args = parser.parse_args(args)
args.func(args)
except qubes.exc.QubesException as e:
parser.print_error(e.message)
return 1
if __name__ == '__main__':

View File

@ -187,7 +187,12 @@ def main(args=None):
command line.
'''
parser = get_parser()
args = parser.parse_args(args)
try:
args = parser.parse_args(args)
except qubes.exc.QubesException as e:
parser.print_error(e.message)
return 1
if args.command is None or args.command == 'list':
list_pools(args.app)
elif args.command == 'add':