@@ -313,8 +313,12 @@ impl Manifestation {
313313
314314 // Read configuration and delete it
315315 let rel_config_path = prefix. rel_manifest_file ( CONFIG_FILE ) ;
316- let config_str = utils:: read_file ( "dist config" , & prefix. path ( ) . join ( & rel_config_path) ) ?;
317- let config = Config :: parse ( & config_str) ?;
316+ let abs_config_path = prefix. path ( ) . join ( & rel_config_path) ;
317+ let config_str = utils:: read_file ( "dist config" , & abs_config_path) ?;
318+ let config = Config :: parse ( & config_str) . with_context ( || RustupError :: ParsingFile {
319+ name : "config" ,
320+ path : abs_config_path,
321+ } ) ?;
318322 tx. remove_file ( "dist config" , rel_config_path) ?;
319323
320324 for component in config. components {
@@ -359,7 +363,12 @@ impl Manifestation {
359363 let config_path = prefix. path ( ) . join ( rel_config_path) ;
360364 if utils:: path_exists ( & config_path) {
361365 let config_str = utils:: read_file ( "dist config" , & config_path) ?;
362- Ok ( Some ( Config :: parse ( & config_str) ?) )
366+ Ok ( Some ( Config :: parse ( & config_str) . with_context ( || {
367+ RustupError :: ParsingFile {
368+ name : "Config" ,
369+ path : config_path,
370+ }
371+ } ) ?) )
363372 } else {
364373 Ok ( None )
365374 }
@@ -371,7 +380,12 @@ impl Manifestation {
371380 let old_manifest_path = prefix. manifest_file ( DIST_MANIFEST ) ;
372381 if utils:: path_exists ( & old_manifest_path) {
373382 let manifest_str = utils:: read_file ( "installed manifest" , & old_manifest_path) ?;
374- Ok ( Some ( Manifest :: parse ( & manifest_str) ?) )
383+ Ok ( Some ( Manifest :: parse ( & manifest_str) . with_context ( || {
384+ RustupError :: ParsingFile {
385+ name : "manifest" ,
386+ path : old_manifest_path,
387+ }
388+ } ) ?) )
375389 } else {
376390 Ok ( None )
377391 }
0 commit comments