Skip to content

Commit

Permalink
Added Error Handling for Bad Response Header
Browse files Browse the repository at this point in the history
Added additional error handling for a bad response header.
  • Loading branch information
peytoncasper committed Aug 31, 2015
1 parent eb1e7f5 commit 81eccbe
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/KillrVideo.SuggestedVideos/SuggestVideos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@ public async Task<RelatedVideos> GetRelatedVideos(Guid videoId)
var response = client.Execute(request);
var content = response.Content;
var mltQuery = JsonConvert.DeserializeObject<MLTQuery>(content);
if (mltQuery.responseHeader.status != 0)
return new RelatedVideos
{
VideoId = videoId,
Videos = mltQuery.response.docs
};
else
return new RelatedVideos { VideoId = videoId, Videos = Enumerable.Empty<VideoPreview>() };



return new RelatedVideos
{
VideoId = videoId,
Videos = mltQuery.response.docs
};
}

/// <summary>
Expand Down

0 comments on commit 81eccbe

Please sign in to comment.