Improved error handling
This commit is contained in:
parent
50e9323b4b
commit
d745444609
@ -3,6 +3,8 @@ from pyn.config import load_config
|
|||||||
|
|
||||||
from pyn import commands, todo # type: ignore
|
from pyn import commands, todo # type: ignore
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
options = vars(parser.parse_args())
|
options = vars(parser.parse_args())
|
||||||
@ -22,7 +24,8 @@ def main():
|
|||||||
try:
|
try:
|
||||||
f(**options)
|
f(**options)
|
||||||
except RuntimeError as e:
|
except RuntimeError as e:
|
||||||
parser.exit(1, str(e))
|
sys.stderr.write(f"{e}\n")
|
||||||
|
parser.exit(1)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user