added try/except for the delete logbook entry input from user

This commit is contained in:
MeaTLoTioN 2022-03-31 09:47:28 +01:00
parent 64656bf332
commit bed5ab4a1a

View File

@ -147,7 +147,7 @@ def addLogBook() :
writeln("|CL")
write("Enter the date for this log entry (YYYY-MM-DD HH:MM:SS): ")
getDate = getstr(1,16,16,now)
getDate = getstr(1,20,20,now)
if not getDate :
return isNull()
@ -222,6 +222,7 @@ def delLogBook() :
writeln("["+str(I+1)+"] "+tmpDB[I])
write("|CREnter the number of the entry to delete: ")
getDate = getstr(1,16,16,"")
try:
if getDate :
NUM = int(getDate) - 1
if tmpDB[NUM] in db["logs"] :
@ -232,6 +233,9 @@ def delLogBook() :
else :
writeln("No log entry with that date, please check and try again.")
writeln("|PA")
except:
writeln("You entered invalid data, aborted!")
writeln("|PA")
else:
writeln("")
writeln("No records to delete. Aborted.".center(71))