File tree Expand file tree Collapse file tree 2 files changed +6
-14
lines changed Expand file tree Collapse file tree 2 files changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -42,25 +42,17 @@ impl DownloadManager {
42
42
manager
43
43
}
44
44
45
- pub fn download (
46
- & self ,
47
- url : impl TryInto < Url > ,
48
- destination : impl AsRef < Path > ,
49
- ) -> Result < DownloadBuilder , Error > {
50
- let url = url
51
- . try_into ( )
52
- . map_err ( |_| Error :: Download ( DownloadError :: InvalidUrl ) ) ?;
53
- Ok ( DownloadBuilder :: new ( self , url, destination) )
45
+ pub fn download ( & self , url : Url , destination : impl AsRef < Path > ) -> DownloadBuilder {
46
+ DownloadBuilder :: new ( self , url, destination)
54
47
}
55
48
56
49
pub fn download_with_config (
57
50
& self ,
58
51
url : Url ,
59
52
destination : impl AsRef < Path > ,
60
53
config : DownloadConfig ,
61
- ) -> Result < DownloadBuilder , Error > {
62
- self . download ( url, destination)
63
- . map ( |builder| builder. with_config ( config) )
54
+ ) -> DownloadBuilder {
55
+ self . download ( url, destination) . with_config ( config)
64
56
}
65
57
66
58
pub async fn set_max_parallel_downloads ( & self , limit : usize ) -> Result < ( ) , Error > {
Original file line number Diff line number Diff line change @@ -27,6 +27,6 @@ pub enum DownloadError {
27
27
ManagerShutdown ,
28
28
#[ error( "File already exists: {path}" ) ]
29
29
FileExists { path : PathBuf } ,
30
- #[ error( "Invalid URL" ) ]
31
- InvalidUrl ,
30
+ #[ error( "Invalid URL: {0} " ) ]
31
+ InvalidUrl ( # [ from ] url :: ParseError ) ,
32
32
}
You can’t perform that action at this time.
0 commit comments