Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fec7af9

Browse files
committed
seq: Use parser.error() for reporting invalid decimal arguments
1 parent 13d23b4 commit fec7af9

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

userland/utilities/seq.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import math
2-
import sys
32
from decimal import Decimal, InvalidOperation
43

54
from .. import core
@@ -45,12 +44,9 @@ def python_userland_seq(opts, args):
4544

4645
def arg_to_decimal(arg: str) -> Decimal:
4746
try:
48-
return Decimal(
49-
arg,
50-
)
47+
return Decimal(arg)
5148
except InvalidOperation:
52-
print(f"invalid decimal argument: {arg}", file=sys.stderr)
53-
sys.exit(1)
49+
parser.error(f"invalid decimal argument: {arg}")
5450

5551
if len(args) == 1:
5652
first = Decimal(1)

0 commit comments

Comments
 (0)