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

@@ -8,13 +8,21 @@ namespace VDownload.Sources.Common
{
public class MediaSearchException : Exception
{
#region PROPERTIES
public string StringCode { get; protected set; }
#endregion
#region CONSTRUCTORS
public MediaSearchException() : base() { }
public MediaSearchException(string message) : base(message) { }
public MediaSearchException(string message, Exception inner) : base(message, inner) { }
public MediaSearchException(string stringCode) : this(stringCode, stringCode) { }
public MediaSearchException(string stringCode, string message) : base(message)
{
StringCode = stringCode;
}
#endregion
}

View File

@@ -32,7 +32,7 @@ namespace VDownload.Sources.Common
return video;
}
}
throw new MediaSearchException("Invalid url"); // TODO : Change to string resource
throw CreateExceptionUnknownMediaType();
}
public async Task<Playlist> SearchPlaylist(string url, int maxVideoCount)
@@ -47,7 +47,7 @@ namespace VDownload.Sources.Common
return video;
}
}
throw new MediaSearchException("Invalid url"); // TODO : Change to string resource
throw CreateExceptionUnknownMediaType();
}
#endregion
@@ -60,6 +60,9 @@ namespace VDownload.Sources.Common
protected abstract IEnumerable<SearchRegexPlaylist> GetPlaylistRegexes();
protected MediaSearchException CreateExceptionUnknownMediaType() => new MediaSearchException("UnknownMediaType");
protected MediaSearchException CreateExceptionEmptyPlaylist() => new MediaSearchException("EmptyPlaylist");
#endregion
}
}