hardcoded search error messages changed to string resources

This commit is contained in:
2024-03-03 16:23:45 +01:00
Unverified
parent 2da59382a3
commit c3724921f3
7 changed files with 202 additions and 21 deletions

View File

@@ -58,7 +58,8 @@ namespace VDownload.Sources
return await mapping.Service.SearchVideo(url);
}
}
throw new MediaSearchException("Source is not supported"); // TODO : Change to string resource
throw CreateExceptionSourceNotSupported();
}
public async Task<Playlist> SearchPlaylist(string url, int maxVideoCount)
@@ -72,7 +73,8 @@ namespace VDownload.Sources
return await mapping.Service.SearchPlaylist(url, maxVideoCount);
}
}
throw new MediaSearchException("Source is not supported"); // TODO : Change to string resource
throw CreateExceptionSourceNotSupported();
}
#endregion
@@ -81,14 +83,17 @@ namespace VDownload.Sources
#region PRIVATE METHODS
private void BaseUrlCheck(string url)
protected void BaseUrlCheck(string url)
{
if (string.IsNullOrWhiteSpace(url))
{
throw new MediaSearchException("Url cannot be empty"); // TODO : Change to string resource
throw CreateExceptionEmptyUrl();
}
}
protected MediaSearchException CreateExceptionSourceNotSupported() => new MediaSearchException("SourceNotSupported");
protected MediaSearchException CreateExceptionEmptyUrl() => new MediaSearchException("EmptyUrl");
#endregion
}
}