edsm-getnearest: now exits with code 2 on system not found
This commit is contained in:
parent
b697a30f75
commit
6dc1a02691
1 changed files with 5 additions and 2 deletions
|
@ -5,7 +5,7 @@ import requests
|
||||||
import sys
|
import sys
|
||||||
import tkinter as tk
|
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
|
from pyEDSM.edsm.models import System, Commander
|
||||||
|
|
||||||
class EdsmApiException(Exception):
|
class EdsmApiException(Exception):
|
||||||
|
@ -86,9 +86,12 @@ def outputGui():
|
||||||
def outputText():
|
def outputText():
|
||||||
try:
|
try:
|
||||||
distances = getDistances(system, cmdrs)
|
distances = getDistances(system, cmdrs)
|
||||||
except (ServerError, NotFoundError) as e:
|
except ServerError as e:
|
||||||
print(e)
|
print(e)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
except SystemNotFoundError as e:
|
||||||
|
print(e)
|
||||||
|
exit(2)
|
||||||
except EdsmApiException as e:
|
except EdsmApiException as e:
|
||||||
print(e)
|
print(e)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
Loading…
Reference in a new issue