Exemple #1
0
        public async Task <IActionResult> GetPlaylists(string applicationId)
        {
            if (string.IsNullOrWhiteSpace(applicationId) || !Guid.TryParse(applicationId, out var guidOutput))
            {
                return(WarningLogBadRequest("Error: Invalid parameters given.")); //Generic error to not give too much information
            }

            try
            {
                return(Ok(await _spotifyService.GetPlaylists(applicationId)));
            }
            catch (InvalidApplicationIdException ex)
            {
                return(WarningLogBadRequest("Failed to find a matching application id. Please disconnect from Spotify and try again.", ex));
            }
            catch (Exception ex)
            {
                return(WarningLogBadRequest("Failed to retrieve playlist names.", ex));
            }
        }