File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -289,6 +289,10 @@ impl de::Error for ConfigError {
289289 fn custom < T : fmt:: Display > ( msg : T ) -> Self {
290290 Self :: Message ( msg. to_string ( ) )
291291 }
292+
293+ fn missing_field ( field : & ' static str ) -> Self {
294+ Self :: NotFound ( field. into ( ) )
295+ }
292296}
293297
294298impl ser:: Error for ConfigError {
Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ fn test_get_missing_field() {
158158 let res = c. get :: < InnerSettings > ( "inner" ) ;
159159 assert_data_eq ! (
160160 res. unwrap_err( ) . to_string( ) ,
161- str ![ "missing field ` value2` for key `inner`" ]
161+ str ![ [ r# "missing configuration field " value2" for key `inner`"# ] ]
162162 ) ;
163163}
164164
@@ -184,7 +184,7 @@ fn test_get_missing_field_file() {
184184 let res = c. get :: < InnerSettings > ( "inner" ) ;
185185 assert_data_eq ! (
186186 res. unwrap_err( ) . to_string( ) ,
187- str ![ "missing field ` value2` for key `inner`" ]
187+ str ![ [ r# "missing configuration field " value2" for key `inner`"# ] ]
188188 ) ;
189189}
190190
@@ -468,6 +468,6 @@ fn test_deserialize_missing_field_file() {
468468 let res = c. try_deserialize :: < Settings > ( ) ;
469469 assert_data_eq ! (
470470 res. unwrap_err( ) . to_string( ) ,
471- str ![ "missing field `value2` for key ` inner`" ]
471+ str ![ [ r# "missing configuration field " inner.value2""# ] ]
472472 ) ;
473473}
You can’t perform that action at this time.
0 commit comments