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

@@ -129,12 +129,18 @@
<data name="TwitchChannelNotFound" xml:space="preserve">
<value>Invalid url. Twitch channel not found.</value>
</data>
<data name="TwitchClipNotFound" xml:space="preserve">
<value>Invalid url. Twitch clip not found.</value>
</data>
<data name="TwitchNotAuthenticated" xml:space="preserve">
<value>Twitch authentication error. Not authenticated to Twitch.</value>
</data>
<data name="TwitchTokenValidationUnsuccessful" xml:space="preserve">
<value>Twitch authentication error. Authentication token is invalid.</value>
</data>
<data name="TwitchVodNotFound" xml:space="preserve">
<value>Invalid url. Twitch VOD not found.</value>
</data>
<data name="UnknownMediaType" xml:space="preserve">
<value>Invalid url. Url does not match any of supported source's media types.</value>
</data>

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
}