File tree 2 files changed +13
-3
lines changed
gix-config/src/file/includes
2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,14 @@ fn append_followed_includes_recursively(
99
99
}
100
100
101
101
buf. clear ( ) ;
102
- std:: io:: copy ( & mut std:: fs:: File :: open ( & config_path) ?, buf) ?;
102
+ std:: io:: copy (
103
+ & mut std:: fs:: File :: open ( & config_path) . map_err ( |err| Error :: Io {
104
+ source : err,
105
+ path : config_path. to_owned ( ) ,
106
+ } ) ?,
107
+ buf,
108
+ )
109
+ . map_err ( Error :: CopyBuffer ) ?;
103
110
let config_meta = Metadata {
104
111
path : Some ( config_path) ,
105
112
trust : meta. trust ,
Original file line number Diff line number Diff line change 1
1
use crate :: { parse, path:: interpolate} ;
2
+ use std:: path:: PathBuf ;
2
3
3
4
/// The error returned when following includes.
4
5
#[ derive( Debug , thiserror:: Error ) ]
5
6
#[ allow( missing_docs) ]
6
7
pub enum Error {
7
- #[ error( transparent) ]
8
- Io ( #[ from] std:: io:: Error ) ,
8
+ #[ error( "Failed to copy configuration file into buffer" ) ]
9
+ CopyBuffer ( #[ source] std:: io:: Error ) ,
10
+ #[ error( "Could not read included configuration file at '{}'" , path. display( ) ) ]
11
+ Io { path : PathBuf , source : std:: io:: Error } ,
9
12
#[ error( transparent) ]
10
13
Parse ( #[ from] parse:: Error ) ,
11
14
#[ error( transparent) ]
You can’t perform that action at this time.
0 commit comments