예제 #1
0
 public SimilarArtistsResponse GetSimilarArtists(string artist)
 {
     try {
         var similarArtistsResponse =
             _serviceClient.Get <SimilarArtistsResponse>(_urlBuilder.BuildArtistGetSimilatUrl(artist));
         if (similarArtistsResponse.SimilarArtists == null)
         {
             similarArtistsResponse.SimilarArtists = new SimilarArtists {
                 Artists = new Artist[] {}
             };
         }
         if (similarArtistsResponse.SimilarArtists.Artists == null)
         {
             similarArtistsResponse.SimilarArtists.Artists = new Artist[] {};
         }
         return(similarArtistsResponse);
     }
     catch (Exception ex) {
         _logFactory.GetLogger(typeof(ArtistService))
         .ErrorFormat(GetSimilarArtistsErrorMessageFormat, artist, ex.Message);
         throw new LastfmServiceException(
                   string.Format(GetSimilarArtistsErrorMessageFormat, artist, ex.Message), ex);
     }
 }