From 6dc1a026917f341e2183505efe27a559e1d84dcf Mon Sep 17 00:00:00 2001 From: alterNERDtive Date: Mon, 14 Oct 2019 10:14:23 +0200 Subject: [PATCH] edsm-getnearest: now exits with code 2 on system not found --- edsm-getnearest.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/edsm-getnearest.py b/edsm-getnearest.py index e2fb194..9c94dc4 100755 --- a/edsm-getnearest.py +++ b/edsm-getnearest.py @@ -5,7 +5,7 @@ import requests import sys import tkinter as tk -from pyEDSM.edsm.exception import ServerError, NotFoundError +from pyEDSM.edsm.exception import ServerError, SystemNotFoundError from pyEDSM.edsm.models import System, Commander class EdsmApiException(Exception): @@ -86,9 +86,12 @@ def outputGui(): def outputText(): try: distances = getDistances(system, cmdrs) - except (ServerError, NotFoundError) as e: + except ServerError as e: print(e) exit(1) + except SystemNotFoundError as e: + print(e) + exit(2) except EdsmApiException as e: print(e) exit(1)