cleaned up error handling
This commit is contained in:
@@ -198,6 +198,7 @@ def configdisplay():
|
||||
errorhandler(error, funchtion)
|
||||
|
||||
def export():
|
||||
try:
|
||||
if lang == "1":
|
||||
with open("Configuationtable.json", "r") as file:
|
||||
data = json.loads(file.read())
|
||||
@@ -248,6 +249,10 @@ def export():
|
||||
error = ('1')
|
||||
funchtion = ('6')
|
||||
errorhandler(error, funchtion)
|
||||
except:
|
||||
error = 2
|
||||
funchtion = 3
|
||||
errorhandler(error, funchtion)
|
||||
|
||||
def errorhandler(error, funchtion):
|
||||
options = {
|
||||
@@ -266,9 +271,30 @@ def errorhandler(error, funchtion):
|
||||
print(" A language baised error has occured \n Ein sprachbasierter Fehler ist aufgetreten")
|
||||
time.sleep(1.5987654321)
|
||||
lang()
|
||||
funchtionhandler(funchtion)
|
||||
elif error == "2":
|
||||
if lang == 1:
|
||||
print("read and/or write error occured, please try again or wait for next patch")
|
||||
time.sleep(1.5987654321)
|
||||
funchtionhandler(funchtion)
|
||||
|
||||
def funchtionhandler(funchtion):
|
||||
options = {
|
||||
'1': start,
|
||||
'2': load,
|
||||
'3': Menu,
|
||||
'4': editor,
|
||||
'5': configdisplay,
|
||||
'6': export,
|
||||
'7': existstage1,
|
||||
'8': existstage1,
|
||||
'9': load,
|
||||
'10': exit,
|
||||
}
|
||||
if funchtion in options:
|
||||
options[funchtion]()
|
||||
|
||||
|
||||
def existstage1():
|
||||
if lang == 1:
|
||||
os.system('cls')
|
||||
|
||||
Reference in New Issue
Block a user