smtpdummy: Better error handling
This commit is contained in:
parent
fd4722f989
commit
72e37e0921
|
@ -141,7 +141,10 @@ Input arguments:
|
||||||
next = True
|
next = True
|
||||||
while next:
|
while next:
|
||||||
line = p.stdout.readline()
|
line = p.stdout.readline()
|
||||||
|
try:
|
||||||
code = int(line[:3])
|
code = int(line[:3])
|
||||||
|
except ValueError:
|
||||||
|
raise ValueError(f"Could not parse line: '{line.decode()}'")
|
||||||
success = code < 400
|
success = code < 400
|
||||||
color = colorama.Fore.GREEN if success else colorama.Fore.RED
|
color = colorama.Fore.GREEN if success else colorama.Fore.RED
|
||||||
if not args.quiet:
|
if not args.quiet:
|
||||||
|
|
Loading…
Reference in a new issue