@@ -577,40 +577,35 @@ class ClipperClass extends ComponentBase<ClipperState, {}> {
577
577
578
578
this . setState ( { userResult : { status : Status . InProgress } } ) ;
579
579
type ErrorObject = { updateReason : UpdateReason , correlationId ?: string , error : string , errorDescription : string } ;
580
- Clipper . getExtensionCommunicator ( ) . callRemoteFunction ( Constants . FunctionKeys . signInUser , { param : authType , callback : ( data : UserInfo | ErrorObject ) => {
580
+
581
+ Clipper . getExtensionCommunicator ( ) . callRemoteFunction ( Constants . FunctionKeys . signInUser , {
582
+ param : authType , callback : ( data : UserInfo | ErrorObject ) => {
581
583
// For cleaner referencing
582
584
let updatedUser = data as UserInfo ;
583
585
let errorObject = data as ErrorObject ;
584
586
585
- // Unexpected errors
586
- let errorPrefix = AuthType [ authType ] + "; " ;
587
- let error : string ;
588
- if ( ! updatedUser ) {
589
- error = errorPrefix + "The " + Constants . FunctionKeys . signInUser + " remote function incorrectly returned an undefined object" ;
590
- } else if ( errorObject . error || errorObject . errorDescription ) {
591
- // Something went wrong on the auth server
592
- error = errorPrefix + errorObject . error + ": " + errorObject . errorDescription ;
593
- handleSignInEvent . setCustomProperty ( Log . PropertyName . Custom . CorrelationId , errorObject . correlationId ) ;
594
- }
595
-
596
- if ( error ) {
597
- handleSignInEvent . setStatus ( Log . Status . Failed ) ;
598
- handleSignInEvent . setFailureInfo ( { error : error } ) ;
587
+ let errorsFound = errorObject . error || errorObject . errorDescription ;
588
+ if ( errorsFound ) {
589
+ errorObject . errorDescription = AuthType [ authType ] + ": " + errorObject . error + ": " + errorObject . errorDescription ;
599
590
600
- errorObject . errorDescription = error ;
601
591
this . state . setState ( { userResult : { status : Status . Failed , data : errorObject } } ) ;
602
592
593
+ handleSignInEvent . setStatus ( Log . Status . Failed ) ;
594
+ handleSignInEvent . setFailureInfo ( { error : errorObject . errorDescription } ) ;
595
+ handleSignInEvent . setCustomProperty ( Log . PropertyName . Custom . CorrelationId , errorObject . correlationId ) ;
596
+
603
597
Clipper . logger . logUserFunnel ( Log . Funnel . Label . AuthSignInFailed ) ;
604
598
}
605
599
606
600
let userInfoReturned = updatedUser && ! ! updatedUser . user ;
607
601
if ( userInfoReturned ) {
608
- // Sign in succeeded
609
602
Clipper . storeValue ( ClipperStorageKeys . hasPatchPermissions , "true" ) ;
610
603
Clipper . logger . logUserFunnel ( Log . Funnel . Label . AuthSignInCompleted ) ;
611
604
}
605
+
612
606
handleSignInEvent . setCustomProperty ( Log . PropertyName . Custom . UserInformationReturned , userInfoReturned ) ;
613
- handleSignInEvent . setCustomProperty ( Log . PropertyName . Custom . SignInCancelled , ! error && ! userInfoReturned ) ;
607
+ handleSignInEvent . setCustomProperty ( Log . PropertyName . Custom . SignInCancelled , ! errorsFound && ! userInfoReturned ) ;
608
+
614
609
Clipper . logger . logEvent ( handleSignInEvent ) ;
615
610
} } ) ;
616
611
}
0 commit comments