@@ -518,36 +518,28 @@ private void SaveToUserProfileService(Experiment experiment = null,
518
518
Variation variation = null
519
519
)
520
520
{
521
- var useSpecificLogEntry = experiment != null && variation != null &&
522
- ! string . IsNullOrEmpty ( _userProfile ? . UserId ) ;
523
-
521
+ var hasExperimentDetails = experiment != null && variation != null &&
522
+ ! string . IsNullOrEmpty ( _userProfile . UserId ) ;
524
523
try
525
524
{
526
- if ( _userProfile ! = null )
525
+ if ( _userProfile = = null )
527
526
{
528
- UserProfileService . Save ( _userProfile . ToMap ( ) ) ;
529
- if ( useSpecificLogEntry )
530
- {
531
- Logger . Log ( LogLevel . INFO ,
532
- $ "Saved variation \" { variation . Id } \" of experiment \" { experiment . Id } \" for user \" { _userProfile . UserId } \" .") ;
533
- }
534
- else
535
- {
536
- Logger . Log ( LogLevel . INFO , "Saved user profile after batch decision." ) ;
537
- }
527
+ return ;
538
528
}
529
+
530
+ UserProfileService . Save ( _userProfile . ToMap ( ) ) ;
531
+
532
+ Logger . Log ( LogLevel . INFO ,
533
+ hasExperimentDetails ?
534
+ $ "Saved variation \" { variation . Id } \" of experiment \" { experiment . Id } \" for user \" { _userProfile . UserId } \" ." :
535
+ "Saved user profile after batch decision." ) ;
539
536
}
540
537
catch ( Exception exception )
541
538
{
542
- if ( useSpecificLogEntry )
543
- {
544
- Logger . Log ( LogLevel . ERROR ,
545
- $ "Failed to save variation \" { variation . Id } \" of experiment \" { experiment . Id } \" for user \" { _userProfile . UserId } \" .") ;
546
- }
547
- else
548
- {
549
- Logger . Log ( LogLevel . ERROR , "Failed to save user profile after batch decision." ) ;
550
- }
539
+ Logger . Log ( LogLevel . ERROR ,
540
+ hasExperimentDetails ?
541
+ $ "Failed to save variation \" { variation . Id } \" of experiment \" { experiment . Id } \" for user \" { _userProfile . UserId } \" ." :
542
+ "Failed to save user profile after batch decision." ) ;
551
543
552
544
ErrorHandler . HandleError (
553
545
new Exceptions . OptimizelyRuntimeException ( exception . Message ) ) ;
0 commit comments