File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -289,6 +289,10 @@ impl de::Error for ConfigError {
289
289
fn custom < T : fmt:: Display > ( msg : T ) -> Self {
290
290
Self :: Message ( msg. to_string ( ) )
291
291
}
292
+
293
+ fn missing_field ( field : & ' static str ) -> Self {
294
+ Self :: NotFound ( field. into ( ) )
295
+ }
292
296
}
293
297
294
298
impl ser:: Error for ConfigError {
Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ fn test_get_missing_field() {
158
158
let res = c. get :: < InnerSettings > ( "inner" ) ;
159
159
assert_data_eq ! (
160
160
res. unwrap_err( ) . to_string( ) ,
161
- str ![ "missing field ` value2` for key `inner`" ]
161
+ str ![ [ r# "missing configuration field " value2" for key `inner`"# ] ]
162
162
) ;
163
163
}
164
164
@@ -184,7 +184,7 @@ fn test_get_missing_field_file() {
184
184
let res = c. get :: < InnerSettings > ( "inner" ) ;
185
185
assert_data_eq ! (
186
186
res. unwrap_err( ) . to_string( ) ,
187
- str ![ "missing field ` value2` for key `inner`" ]
187
+ str ![ [ r# "missing configuration field " value2" for key `inner`"# ] ]
188
188
) ;
189
189
}
190
190
@@ -468,6 +468,6 @@ fn test_deserialize_missing_field_file() {
468
468
let res = c. try_deserialize :: < Settings > ( ) ;
469
469
assert_data_eq ! (
470
470
res. unwrap_err( ) . to_string( ) ,
471
- str ![ "missing field `value2` for key ` inner`" ]
471
+ str ![ [ r# "missing configuration field " inner.value2""# ] ]
472
472
) ;
473
473
}
You can’t perform that action at this time.
0 commit comments