Add better error handling to login view