twitch not found error added

This commit is contained in:
2024-03-09 21:10:07 +01:00
Unverified
parent 47e902134e
commit b515abeca5
2 changed files with 18 additions and 0 deletions

View File

@@ -87,6 +87,11 @@ namespace VDownload.Sources.Twitch
GetVideosResponse info = await _apiService.HelixGetVideo(id, token);
if (info.Data is null)
{
throw CreateExceptionVodNotFound();
}
Api.Helix.GetVideos.Response.Data vodResponse = info.Data[0];
TwitchVod vod = await ParseVod(vodResponse);
@@ -100,6 +105,11 @@ namespace VDownload.Sources.Twitch
GetClipsResponse info = await _apiService.HelixGetClip(id, token);
if (info.Data.Count == 0)
{
throw CreateExceptionClipNotFound();
}
Api.Helix.GetClips.Response.Data clipResponse = info.Data[0];
TwitchClip clip = await ParseClip(clipResponse);
@@ -306,6 +316,8 @@ namespace VDownload.Sources.Twitch
protected MediaSearchException CreateExceptionNotAuthenticated() => new MediaSearchException("TwitchNotAuthenticated");
protected MediaSearchException CreateExceptionTokenValidationUnsuccessful() => new MediaSearchException("TwitchTokenValidationUnsuccessful");
protected MediaSearchException CreateExceptionChannelNotFound() => new MediaSearchException("TwitchChannelNotFound");
protected MediaSearchException CreateExceptionVodNotFound() => new MediaSearchException("TwitchVodNotFound");
protected MediaSearchException CreateExceptionClipNotFound() => new MediaSearchException("TwitchClipNotFound");
#endregion
}