Python User Input Error Handling In Javascript