mirror of
https://github.com/codingo/Interlace.git
synced 2025-12-18 07:14:20 +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
|
@staticmethod
|
||||||
def check_positive(parser, arg):
|
def check_positive(parser, arg):
|
||||||
ivalue = int(arg)
|
try:
|
||||||
if ivalue <= 0:
|
ivalue = int(arg)
|
||||||
raise parser.ArgumentTypeError("%s is not a valid positive integer!" % 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
|
return arg
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user