File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 11use super :: CrateTrait ;
2- use crate :: Workspace ;
2+ use crate :: { PrepareError , Workspace } ;
33use anyhow:: Context as _;
44use flate2:: read:: GzDecoder ;
55use log:: info;
@@ -194,10 +194,10 @@ impl CrateTrait for RegistryCrate {
194194 ) ;
195195 if let Err ( err) = unpack_without_first_dir ( & mut tar, dest) {
196196 let _ = crate :: utils:: remove_dir_all ( dest) ;
197- Err ( err. context ( format ! (
198- "unable to download {} version {}" ,
199- self . name , self . version
200- ) ) )
197+ Err ( err. context ( PrepareError :: UnpackFailed {
198+ krate : self . name . clone ( ) ,
199+ version : self . version . clone ( ) ,
200+ } ) )
201201 } else {
202202 Ok ( ( ) )
203203 }
Original file line number Diff line number Diff line change @@ -424,6 +424,14 @@ pub enum PrepareError {
424424 /// repo url
425425 url : String ,
426426 } ,
427+ /// failed to unpack crate
428+ #[ error( "failed to unpack {krate} version {version}" ) ]
429+ UnpackFailed {
430+ /// the crates name
431+ krate : String ,
432+ /// the crates version
433+ version : String ,
434+ } ,
427435}
428436
429437#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments