Exemplo n.º 1
0
        private ValidationFailure TestConnection()
        {
            try
            {
                using (var api = GetApi())
                {
                    var profile = _spotifyProxy.GetPrivateProfile(this, api);
                    _logger.Debug($"Connected to spotify profile {profile.DisplayName} [{profile.Id}]");
                    return(null);
                }
            }
            catch (SpotifyAuthorizationException ex)
            {
                _logger.Warn(ex, "Spotify Authentication Error");
                return(new ValidationFailure(string.Empty, $"Spotify authentication error: {ex.Message}"));
            }
            catch (Exception ex)
            {
                _logger.Warn(ex, "Unable to connect to Spotify");

                return(new ValidationFailure(string.Empty, "Unable to connect to import list, check the log for more details"));
            }
        }