File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 99 } ,
1010 log:: error,
1111 serde:: Deserialize ,
12- std:: { collections:: HashMap , io, process:: Command } ,
12+ std:: {
13+ collections:: HashMap ,
14+ io,
15+ process:: { exit, Command } ,
16+ } ,
1317} ;
1418
1519fn empty_custom_types ( ) -> HashMap < String , CustomType > {
@@ -158,7 +162,10 @@ impl Rcfile {
158162 if output. status . success ( ) {
159163 String :: from_utf8 ( output. stdout ) . map_err ( |err| io:: Error :: new ( io:: ErrorKind :: Other , err) )
160164 } else {
161- Err ( io:: Error :: new ( io:: ErrorKind :: Other , "Failed to run cosmiconfig" ) )
165+ Err ( io:: Error :: new (
166+ io:: ErrorKind :: Other ,
167+ String :: from_utf8 ( output. stderr ) . expect ( "Failed to run cosmiconfig" ) ,
168+ ) )
162169 }
163170 } )
164171 . map ( Rcfile :: from_json) ;
@@ -175,7 +182,13 @@ impl Rcfile {
175182
176183 /// Create a new rcfile from a JSON string or revert to defaults
177184 pub fn from_json ( json : String ) -> Rcfile {
178- serde_json:: from_str ( & json) . unwrap_or_else ( |_| Rcfile :: new ( ) )
185+ match serde_json:: from_str ( & json) {
186+ Ok ( rcfile) => rcfile,
187+ Err ( err) => {
188+ error ! ( "Your syncpack config file failed validation\n {err}" ) ;
189+ exit ( 1 ) ;
190+ }
191+ }
179192 }
180193
181194 /// Create every alias defined in the rcfile.
You can’t perform that action at this time.
0 commit comments