Handle ValueError.
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -112,3 +112,4 @@ dmypy.json
 | 
			
		||||
 | 
			
		||||
# database files (may contain sensitive student info)
 | 
			
		||||
*.db
 | 
			
		||||
.vscode
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								TODO.md
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								TODO.md
									
									
									
									
									
								
							@@ -2,7 +2,7 @@ To-Do List
 | 
			
		||||
==========
 | 
			
		||||
 | 
			
		||||
## v0.2
 | 
			
		||||
- [ ] Error handling (when entering invalid data types)
 | 
			
		||||
- [x] Error handling (when entering invalid data types)
 | 
			
		||||
- [ ] Make database contain data for all classes
 | 
			
		||||
- [ ] Flexible mandatory subjects
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -102,6 +102,7 @@ def main():
 | 
			
		||||
 | 
			
		||||
    y = "y"
 | 
			
		||||
    while y == "y":
 | 
			
		||||
        try:
 | 
			
		||||
            id = int(input("Please input the student ID number: "))
 | 
			
		||||
 | 
			
		||||
            if check_id(conn, id):
 | 
			
		||||
@@ -119,6 +120,8 @@ def main():
 | 
			
		||||
                    print("Clear to leave.")
 | 
			
		||||
            else:
 | 
			
		||||
                print("Student does not exist in the database. Please try again.")
 | 
			
		||||
        except ValueError:
 | 
			
		||||
            print("That was not an integer, please try again.")
 | 
			
		||||
 | 
			
		||||
        y = input("Press y key followed by enter to run again.")
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user