@@ -20,13 +20,13 @@ pub fn get_assignment(
2020    subject :  & EvaluationContext , 
2121    expected_type :  Option < VariationType > , 
2222    now :  DateTime < Utc > , 
23- )  -> Result < Option < Assignment > ,   EvaluationError >  { 
23+ )  -> Result < Assignment ,   EvaluationFailure >  { 
2424    let  Some ( config)  = configuration else  { 
2525        log:: trace!( 
2626            flag_key, 
2727            targeting_key = subject. targeting_key( ) ; 
2828            "returning default assignment because of: {}" ,  EvaluationFailure :: ConfigurationMissing ) ; 
29-         return  Ok ( None ) ; 
29+         return  Err ( EvaluationFailure :: ConfigurationMissing ) ; 
3030    } ; 
3131
3232    config. eval_flag ( flag_key,  subject,  expected_type,  now) 
@@ -39,28 +39,26 @@ impl Configuration {
3939        context :  & EvaluationContext , 
4040        expected_type :  Option < VariationType > , 
4141        now :  DateTime < Utc > , 
42-     )  -> Result < Option < Assignment > ,   EvaluationError >  { 
42+     )  -> Result < Assignment ,   EvaluationFailure >  { 
4343        let  result = self 
4444            . flags 
4545            . compiled 
4646            . eval_flag ( flag_key,  context,  expected_type,  now) ; 
4747
48-         match  result { 
48+         match  & result { 
4949            Ok ( assignment)  => { 
5050                log:: trace!( 
51-                 flag_key, 
52-                 targeting_key = context. targeting_key( ) , 
53-                 assignment: serde = assignment. value; 
54-                 "evaluated a flag" ) ; 
55-                 Ok ( Some ( assignment) ) 
51+                     flag_key, 
52+                     targeting_key = context. targeting_key( ) , 
53+                     assignment: serde = assignment. value; 
54+                     "evaluated a flag" ) ; 
5655            } 
5756
5857            Err ( EvaluationFailure :: ConfigurationMissing )  => { 
5958                log:: warn!( 
60-                 flag_key, 
61-                 targeting_key = context. targeting_key( ) ; 
62-                 "evaluating a flag before flags configuration has been fetched" ) ; 
63-                 Ok ( None ) 
59+                     flag_key, 
60+                     targeting_key = context. targeting_key( ) ; 
61+                     "evaluating a flag before flags configuration has been fetched" ) ; 
6462            } 
6563
6664            Err ( EvaluationFailure :: Error ( err) )  => { 
@@ -69,19 +67,16 @@ impl Configuration {
6967                    targeting_key = context. targeting_key( ) ; 
7068                    "error occurred while evaluating a flag: {err}" , 
7169                ) ; 
72-                 Err ( err) 
7370            } 
74- 
75-             // Non-Error failures are considered normal conditions and usually don't need extra 
76-             // attention, so we remap them to Ok(None) before returning to the user. 
7771            Err ( err)  => { 
7872                log:: trace!( 
7973                    flag_key, 
8074                    targeting_key = context. targeting_key( ) ; 
8175                    "returning default assignment because of: {err}" ) ; 
82-                 Ok ( None ) 
8376            } 
8477        } 
78+ 
79+         result
8580    } 
8681} 
8782
@@ -281,8 +276,7 @@ mod tests {
281276                    & subject, 
282277                    Some ( test_case. variation_type ) , 
283278                    now, 
284-                 ) 
285-                 . unwrap_or ( None ) ; 
279+                 ) ; 
286280
287281                let  result_assingment = result
288282                    . as_ref ( ) 
0 commit comments