hardcoded search error messages changed to string resources
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user