File tree 2 files changed +13
-5
lines changed
2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 1
1
use super :: CrateTrait ;
2
- use crate :: Workspace ;
2
+ use crate :: { PrepareError , Workspace } ;
3
3
use anyhow:: Context as _;
4
4
use flate2:: read:: GzDecoder ;
5
5
use log:: info;
@@ -194,10 +194,10 @@ impl CrateTrait for RegistryCrate {
194
194
) ;
195
195
if let Err ( err) = unpack_without_first_dir ( & mut tar, dest) {
196
196
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
+ } ) )
201
201
} else {
202
202
Ok ( ( ) )
203
203
}
Original file line number Diff line number Diff line change @@ -424,6 +424,14 @@ pub enum PrepareError {
424
424
/// repo url
425
425
url : String ,
426
426
} ,
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
+ } ,
427
435
}
428
436
429
437
#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments