@@ -577,40 +577,35 @@ class ClipperClass extends ComponentBase<ClipperState, {}> {
577577
578578 this . setState ( { userResult : { status : Status . InProgress } } ) ;
579579 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 ) => {
581583 // For cleaner referencing
582584 let updatedUser = data as UserInfo ;
583585 let errorObject = data as ErrorObject ;
584586
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 ;
599590
600- errorObject . errorDescription = error ;
601591 this . state . setState ( { userResult : { status : Status . Failed , data : errorObject } } ) ;
602592
593+ handleSignInEvent . setStatus ( Log . Status . Failed ) ;
594+ handleSignInEvent . setFailureInfo ( { error : errorObject . errorDescription } ) ;
595+ handleSignInEvent . setCustomProperty ( Log . PropertyName . Custom . CorrelationId , errorObject . correlationId ) ;
596+
603597 Clipper . logger . logUserFunnel ( Log . Funnel . Label . AuthSignInFailed ) ;
604598 }
605599
606600 let userInfoReturned = updatedUser && ! ! updatedUser . user ;
607601 if ( userInfoReturned ) {
608- // Sign in succeeded
609602 Clipper . storeValue ( ClipperStorageKeys . hasPatchPermissions , "true" ) ;
610603 Clipper . logger . logUserFunnel ( Log . Funnel . Label . AuthSignInCompleted ) ;
611604 }
605+
612606 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+
614609 Clipper . logger . logEvent ( handleSignInEvent ) ;
615610 } } ) ;
616611 }
0 commit comments