Cleaned up error handling for client.