Adding simple error handling to API login