mirror of
https://github.com/codingo/Interlace.git
synced 2025-12-17 06:44:23 +01:00
Merge pull request #97 from ualvesdias/patch-1
Update check_positive method to handle ValueError exception.
This commit is contained in:
@@ -24,9 +24,12 @@ class InputHelper(object):
|
||||
|
||||
@staticmethod
|
||||
def check_positive(parser, arg):
|
||||
ivalue = int(arg)
|
||||
if ivalue <= 0:
|
||||
raise parser.ArgumentTypeError("%s is not a valid positive integer!" % arg)
|
||||
try:
|
||||
ivalue = int(arg)
|
||||
if ivalue <= 0:
|
||||
raise parser.ArgumentTypeError("%s is not a valid positive integer!" % arg)
|
||||
except ValueError as e:
|
||||
raise parser.ArgumentValueError("%s is not a a number!" % arg)
|
||||
|
||||
return arg
|
||||
|
||||
|
||||
Reference in New Issue
Block a user